私がここで間違っていることをちょっと疑問に思います。リストから値を選択すると、コンポーネント入力フィールドに値が入力されていません。コンポーネント選択値を選択して反応選択を更新しません。
class Search extends Component {
constructor(props) {
super(props);
this.state = {
name: 'order_select_field',
placeholder: "Make a selection",
}
}
componentWillMount() {
fetch('http://apirequest.com')
.then(function(response) {
return response.json();
})
.then(function(json) {
this.setState({options: json});
}.bind(this))
}
handleChange(event) {
this.setState({ })
}
render() {
return (
<div>
<Select
name={this.state.name}
options={this.state.options}
placeholder={this.state.placeholder}
/>
</div>
)
}
}
'componentWillMount'でajaxリクエストを使用しないでください!ところで、この方法は基本的にコンストラクタです。 https://facebook.github.io/react/docs/react-component.html#componentwillmount –
Selectコンポーネントにはどのライブラリを使用していますか? –
@JulianSoro私は反応選択を使用しています – Jasonca1