<Multiselect label='Select College' ref="collegeList" onChange={this.handleChange} multiple >
<option value='college1'>college1</option>
<option value='college2'>college2</option>
</Multiselect>
這個組件是從https://github.com/skratchdot/react-bootstrap-multiselect如何在React JS中獲得多個選定的選項值?
應該採取什麼handleChange()函數裏面寫?
你可以嘗試做'handleChange:函數(事件){執行console.log(事件); ''看看它是否記錄任何東西? – gcedo
亞我已經檢查過它,但不知道要查找哪個字段以獲取選定的元素。 – bunty93
實際上來自'onChange'你會收到被單擊的元素本身以及一個布爾值,如果元素被選中則返回true,否則返回false。你會在下面找到我的完整答案。 – gcedo