Is the process of moving the state up (lifting the state) into a common ancestor component the same thing as state hoisting?
CodePudding user response:
Yes, https://reactpatterns.js.org/docs/state-hoisting/
As the example above you are encouraged to lift state up, if two components need to act on the same data or need to use the same callback.
So you should create a common ancestor in this common ancestor and then use the state to manage all the data and callbacks that children will use in rendering as following.
Also this - https://reactjs.org/docs/lifting-state-up.html