Answer the question
In order to leave comments, you need to log in
How to run a hook inside a hook in React Native?
I need to save the data in the storage when redrawing the component.
I am trying to do so
<NavigationEvents onWillFocus={payload => ScreenUpdated(payload)} />
let dispatch = useDispatch()
useEffect(() => {
dispatch(loadPosts(0,0)) //loadPosts- подгрузка актуальных данных
}, [dispatch])
Answer the question
In order to leave comments, you need to log in
ScreenUpdated is called just as a function, not as a component. it does not need to be written with a capital letter and use hooks in it. pass dispatch outside and call it directly with no effect.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question