Skip to content

Instantly share code, notes, and snippets.

@drenther drenther/routes.js
Created Jun 17, 2018

Embed
What would you like to do?
routes for react-ssr
import Home from './components/Home';
import Movie from './components/Movie';
import { fetchAllMovies, fetchMovieById } from './apiCalls';
const routes = [
{
path: '/',
exact: true,
C: Home,
getInitialData: () => fetchAllMovies(),
},
{
path: '/movie/:id',
C: Movie,
getInitialData: (path = '') => fetchMovieById(path.split('/').pop()),
},
];
export default routes;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.