2 ms·
By passing down callback functions as props. One of the basic patterns of React is that parents communicate to their children by passing down data as props, an
by acemarke 10y ago
By passing down callback functions as props. One of the basic patterns of React is that parents communicate to their children by passing down data as props, and they also pass down callback functions that a child can execute to communicate upwards.
There's a great article that describes various component communication patterns at http://andrewhfarmer.com/component-communication/ http://andrewhfarmer.com/component-communication/ .
- rquestion 10y agoThanks. Exactly what I was looking for.
- neurostimulant 10y agoAlso, take a look at optional libraries such as redux (and its friends, e.g. redux-saga or redux-thunk). You don't have to use them, but when your codebase starts getting complicated with lots of callback, perhaps using those state management libraries would help.