V
V
Vann Damm2020-06-11 11:44:55
JavaScript
Vann Damm, 2020-06-11 11:44:55

Parent custom hook fires after child component's logic is executed?

There is a custom parent hook that has a useEffect that records the redux store. Based on this data from the store, the child component renders. But the data from the store in it, at the first render, is present by default, although I dispatched new ones in the parent.
5ee1eea649e83047009595.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
H
hzzzzl, 2020-06-11
@hzzzzl

useEffect is executed after rendering, that is, the entire tree of the parent with daughters is first rendered, and then the mother's useEffect

... you might find it easier to think that effects happen “after render”. React guarantees the DOM has been updated by the time it runs the effects.

https://reactjs.org/docs/hooks-effect.html

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question