I'm trying to make a link open up the react-select component. Anyone know a way to do this with React?
I am trying to do a similar thing where I need to wrap the react-select around a parent dropdown-button. On click of the parent dropdown-button, I want to trigger opening a react-select (with focus in the search/input. Does anyone know how to do this?
This is probably a hack, but here's how I think I'm going to do it:
React.createClass({
onClick(event){
const fieldInput = this.refs.fieldInput;
if (!fieldInput.state.isOpen) {
fieldInput.handleMouseDown(event);
}
},
render(){
<div onClick={this.onClick}
<Select ref='fieldInput'
options={this.props.options}
value={this.props.value}
onChange={this.onChange}/>
</div>
}
});
Most helpful comment
This is probably a hack, but here's how I think I'm going to do it: