Skip to content

Commit 6cc7131

Browse files
committed
Optimized select dropdown to keep previously selected value binded.
1 parent e3f36d7 commit 6cc7131

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

components/SelectDropdown/SelectDropdown.jsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@ import Dropdown from '../Dropdown/Dropdown'
88
class SelectDropdown extends Component {
99
constructor(props) {
1010
super(props)
11-
this.state = _.assign(this.state, { selectedOption : null })
11+
let option = null
12+
if(props && props.options && props.value) {
13+
option = _.find(props.options, {value: props.value})
14+
}
15+
this.state = _.assign(this.state, { selectedOption : option })
1216
}
1317

1418
handleClick(option) {

0 commit comments

Comments
 (0)