Lifting State
Explore how to refactor React components by lifting state between parent and child components. Learn to convert functional components to ES6 class components to handle internal state and methods, enhancing code organization and making components more lightweight.
We'll cover the following...
What does ‘Lifting State’ mean?
Only the App component is a stateful ES6 component in your application. It handles a lot of application state and logic in its class methods. Moreover, we pass a lot of properties to the Table component, most of which are only used in there. It’s not important that the App component knows about them, so the sort functionality could be moved into the Table component.
Moving a sub-state from one component to another is known as lifting state. We want to move state that isn’t used in the App ...