Skip to content

Instantly share code, notes, and snippets.

@shivekkhurana
shivekkhurana / FadeRoute.js
Last active January 2, 2018 18:03 — forked from mhaagens/gist:61f88e3fbfddbe2c00708f3ebd099be4
Transition Motion React Router 4 Route Transition
import React from 'react';
import {Route} from 'react-router-dom';
import PropTypes from 'prop-types';
import {TransitionMotion, spring} from 'react-motion';
const FadeRoute = ({component: Component, ...rest }) => {
return (<Route {...rest} children={({location, match}) => (
<TransitionMotion
willEnter={() => ({opacity: 0})}
willLeave={() => ({opacity: spring(0)})}