1
1
12332112021-09-17 18:30:01
JavaScript
1233211, 2021-09-17 18:30:01

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

1 answer(s)
L
low molecular macro, 2021-09-17
@molekulyarniy

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 question

Ask a Question

731 491 924 answers to any question