React-select: How to use react-select for conditional dropdown.

Created on 27 Dec 2017  路  2Comments  路  Source: JedWatson/react-select

Let's say i have two dropdowns A and B, options in dropdown B should be populated based on the selected value from dropdown A.
How can this be done?

Most helpful comment

Hi @yharish991, please don't take it the wrong way but the issues page of a github repo should not be used for support requests/how to's. That said, the answer to your question is that basically you have to implement this functionality yourself and will depend on your project's setup. I put together a quick n' dirty example on how to do this with just using setState here: https://stackblitz.com/edit/react-mvqwr7

What I did was to set 2 collections with the options and filter the second one with the value selected from the first one. Hope this points you in the right direction.

All 2 comments

Hi @yharish991, please don't take it the wrong way but the issues page of a github repo should not be used for support requests/how to's. That said, the answer to your question is that basically you have to implement this functionality yourself and will depend on your project's setup. I put together a quick n' dirty example on how to do this with just using setState here: https://stackblitz.com/edit/react-mvqwr7

What I did was to set 2 collections with the options and filter the second one with the value selected from the first one. Hope this points you in the right direction.

@jmarmolejos thanks for the help, sorry for the wrong way for creating issue. closing it

Was this page helpful?
0 / 5 - 0 ratings

Related issues

MindRave picture MindRave  路  3Comments

steida picture steida  路  3Comments

juliensnz picture juliensnz  路  3Comments

mjuopperi picture mjuopperi  路  3Comments

x-yuri picture x-yuri  路  3Comments