Using Redux I am getting the previous state value in the React component,how to get the updated value to the React component

Viewed 281

I am using Redux, I am getting the previous state value in the react component whereas in redux reducers the state gets updated correctly, how I can get the updated value in react component

    useEffect((item)=>{
    props.showHome(); 
    },[])

    //I have used onPress which call below function(selectedItem)
    const selectedItem= (item,props) =>{
    props.showList(item); //value is passed to the action
    console.log('In function'+props.listSelected);//listSelected is giving me previous state value}
0 Answers
Related