xoid can provide a scaffolding system for refactoring React class components into function components. During refactoring, intermediate version of the component keeps working.
Let's imagine that the following class component is going to be refactored:
Here's a basic React-like class component runtime prepared in xoid.
We can then easily evolve into the following, working structure without too much refactor:
Observe that the only big differece is replacing
this in the render function with
After getting rid of
this.setState usages, we can get rid of the
Runtime class too.