Skip to content

Instantly share code, notes, and snippets.

@stephencookdev
Created July 16, 2018 15:14
Show Gist options
  • Save stephencookdev/e67902ec29b3759d54884ff7a936868e to your computer and use it in GitHub Desktop.
Save stephencookdev/e67902ec29b3759d54884ff7a936868e to your computer and use it in GitHub Desktop.
`SwitchWithSlide` example - update
componentDidUpdate(prevProps, prevState) {
const prevUniqId = prevProps.uniqKey || prevProps.children.type;
const uniqId = this.props.uniqKey || this.props.children.type;
if (prevUniqId !== uniqId) {
this.setState({
childPosition: Slider.TO_LEFT,
curChild: this.props.children,
curUniqId: uniqId,
prevChild: prevProps.children,
prevUniqId,
animationCallback: this.swapChildren
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment