Update state in SlideToggle when props update
Signed-off-by: Alex Paxton <thealexpaxton@gmail.com>pull/10616/head
parent
172b1f827d
commit
63ea69e679
|
@ -5,10 +5,14 @@ class SlideToggle extends Component {
|
||||||
super(props)
|
super(props)
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
active: this.props.active,
|
active: props.active,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
componentWillReceiveProps(nextProps) {
|
||||||
|
this.setState({active: nextProps.active})
|
||||||
|
}
|
||||||
|
|
||||||
handleClick = () => {
|
handleClick = () => {
|
||||||
const {onToggle} = this.props
|
const {onToggle} = this.props
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue