Skip to content

Commit

Permalink
fix(simple): use componentDidUpdate instead of componentWillReceiveProps
Browse files Browse the repository at this point in the history
  • Loading branch information
jedwards1211 committed Mar 29, 2019
1 parent 570c718 commit fd7458d
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/simple.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ export function createSimpleViewSlider(
}
}

componentWillReceiveProps(nextProps: Props) {
if (nextProps.children !== this.props.children) {
const child = React.Children.only(nextProps.children)
componentDidUpdate(prevProps: Props) {
if (prevProps.children !== this.props.children) {
const child = React.Children.only(this.props.children)
const activeView = parseInt(child.key)
const views = [...this.state.views]
views[activeView] = child
Expand Down Expand Up @@ -91,4 +91,3 @@ export function createSimpleViewSlider(
}

export default createSimpleViewSlider(ViewSlider)

0 comments on commit fd7458d

Please sign in to comment.