Skip to content

Instantly share code, notes, and snippets.

@m-allanson
Created September 25, 2018 12:01
Show Gist options
  • Save m-allanson/fdec624abacf1a5f3cd819ed87622d38 to your computer and use it in GitHub Desktop.
Save m-allanson/fdec624abacf1a5f3cd819ed87622d38 to your computer and use it in GitHub Desktop.
static getDerivedStateFromProps(props, state) {
const { pathname } = props.location;
if (!state.lastPathname || pathname !== state.lastPathname) {
return {
lastPathname: pathname,
transitionName: getTransitionName({
from: state.lastPathname,
to: pathname,
});
};
}
return null;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment