I'm new to React Hooks and I'm facing this problem :
- App component initializes a map from localStorage with useEffect
- it passes this map to child component Hello
Then :
- child component copy this map in its own state and use it manage values editions.
Problem is, as you can see in this stackblitz console log :
parent map: undefined --- child map: undefined // map is first pass empty to the child component
parent map: world --- child map: undefined // then it's populated by parent component effect but child state is not updated
How can I manage proper initialization of map values in child component? Do not hesitate to challenge the whole thing, I'm not sure to use effects properly here.