This is first time I am using ReduxJS.
I have two components one parent and one child.
In child
dispatch(someAction(payload))
In Parent
let some = useSelector((state)=> state.a)
useEffect(()=>{
//some code//
},[some])
Expected:
As per my knowledge I dispacthed a action from child that will change the redux state. Now In parent "some" should get updated too and it should trigger useEffect .
What-is-actually-happening:
useEffect Does not get triggered.
Can somebody please point out what I am doing wrong here?
can you please confirm 2 things:
I hope your problem is related to of the two points mentioned above and yes the useEffect() should run.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.