Mastodon hachyterm.io

Today I’ve been trying to refactor a class-based component that uses getDerivedStateFromProps().

I originally used this lifecycle method to replace the deprecated componentWillMount(). You can read more about that in the blog post about async rendering.

But then I realized that erasing state when props change is an anti-pattern.

Now I’m trying to come up with another solution.

Further Reading