Refactoring the Sorters Component
Learn how to refactor a React sorting component from a parent-child pattern into an internal state management pattern.
The current Sorters component
Let’s take a look at the current Sorters component below:
Refactoring steps
Now, let’s make the Sorters component responsible for its own state and sorting. A few steps are required to do this:
- Remove the
objectprop, and replace it with adata