Answer the question
In order to leave comments, you need to log in
How to call a hook in a component so that it returns new data when the data in this hook has changed?
Such a question, there is a custom hook that changes inside and returns a different result.
in components I use
const accountInfo = useGetAccountInfo();
All is well, but! I use this hook in different components, if I go through another route, then in the component that was re-rendered, there is a new value in accountInfo, and in other components in accountInfo, the old information. How to update in accountInfo components when there are changes in useGetAccountInfo ?
Answer the question
In order to leave comments, you need to log in
declare it in one place and pass it to other components. Because each component has its own state
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question