tbleckert / react-select-search

⚡️ Lightweight select component for React
https://react-select-search.com
MIT License
676 stars 147 forks source link

Move find operation after state has been set #15

Closed patrick91 closed 7 years ago

patrick91 commented 7 years ago

This is a quick fix for an issue I was getting[1], but probably the best place to do this kind of stuff would be in componentDidMount or even better componentWillReceiveProps, otherwise it would work only the first time.

[1] basically the state was undefined since it was set after the finds were called.

tbleckert commented 7 years ago

Yeah, I agree. It should not be handled inside the constructor. Some stuff is still very prototype-ish, haven't had so much time for refactoring. I really appreciate your help.

I'll merge this in since it solves a problem. Refactoring and updated props is another issue.