This repository was archived by the owner on Sep 20, 2021. It is now read-only.
Description Hi! @drcmda I was wondering if you have examples with Reach Router. Here's what I have so far, appreciate the help!
import React , { useState } from 'react' ;
import { Router , Location } from '@reach/router' ;
import { useTransition , animated } from 'react-spring' ;
import { Container } from '../global' ;
import styled from 'styled-components' ;
const AnimatedContainer = styled ( animated ( Container ) ) `` ;
const AnimatedRouter = ( { children } ) => {
const [ index , set ] = useState ( 0 ) ;
const transitions = useTransition ( index , p => p , {
from : { opacity : 0 , transform : 'translate3d(100%,0,0)' } ,
enter : { opacity : 1 , transform : 'translate3d(0%,0,0)' } ,
leave : { opacity : 0 , transform : 'translate3d(-50%,0,0)' } ,
} ) ;
return (
< Location >
{ ( { location } ) => (
< AnimatedContainer key = { location . key } >
< Router location = { location } > { children } </ Router >
</ AnimatedContainer >
) }
</ Location >
) ;
} ;
export default AnimatedRouter ; Reactions are currently unavailable
Hi! @drcmda I was wondering if you have examples with Reach Router. Here's what I have so far, appreciate the help!