Skip to content

Instantly share code, notes, and snippets.

@drenther
Created June 17, 2018 19: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 drenther/532b1d4a40f420593ed19b4abbb64f24 to your computer and use it in GitHub Desktop.
Save drenther/532b1d4a40f420593ed19b4abbb64f24 to your computer and use it in GitHub Desktop.
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