re: Let's build a search bar in React! VIEW POST


Nice Article.

When I use getDerivedStateFromProps() in same way you use componentWillReceiveProps() in List component searching doesn't work.

static getDerivedStateFromProps(nextProps) {
return {
filtered: nextProps.items

I didn't know that getDerivedStateFromProps is called every time we setState(). Link for lifecycles

I wanted to share this thought with you cause I didn't give enough attention about differences between componentWillReceiveProps and getDerivedStateFromProps and IMHO this is kind of important.

code of conduct - report abuse