Skip to content

Instantly share code, notes, and snippets.

@alshdavid
Last active May 11, 2019 07:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alshdavid/da25e743312208e288aa63d9c6f90a56 to your computer and use it in GitHub Desktop.
Save alshdavid/da25e743312208e288aa63d9c6f90a56 to your computer and use it in GitHub Desktop.
Animated Routes
import React from 'react'
export const About = (req, nav) => () => (
<main>
<nav>
<div>
<button onClick={() => nav.navigate('/home')}>Home</button>
<button onClick={() => nav.navigate('/about')}>About</button>
</div>
<div>
<button onClick={() => nav.navigate('/more')}>More &gt;</button>
</div>
</nav>
<h1>{ req.pathname }</h1>
</main>
)
import React from 'react'
export const Home = (req, nav) => () => (
<main>
<nav>
<div>
<button onClick={() => nav.navigate('/home')}>Home</button>
<button onClick={() => nav.navigate('/about')}>About</button>
</div>
<div>
<button onClick={() => nav.navigate('/more')}>More &gt;</button>
</div>
</nav>
<h1>{ req.pathname }</h1>
</main>
)
import React from 'react'
export const More = (req, nav) => () => (
<main>
<nav>
<div>
<button onClick={() => nav.back()}>&lt; Back</button>
</div>
</nav>
<h1>{ req.pathname }</h1>
</main>
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment