im getting an object from my redux state
let weatherState = useSelector((state: RootState) => state.weather) console.log('state ', weatherState); // returns state as expected and shown console.log('loading ', weatherState.loading); // returns false console.log('myWeather ', weatherState.weather?.description); // returns undefined the nested weather is an array, i'm unable to get to that array by using weatherState.weather?[0].description i put 'weatherState.weather?[0].description' inside an if statement, and it fails to compile
vscode is auto filling the description
how do i get the items from the array,
https://stackoverflow.com/questions/66727893/how-to-get-a-nested-object-javascript-react-typescript March 21, 2021 at 08:54AM


没有评论:
发表评论