Created
June 17, 2018 19:27
-
-
Save drenther/532b1d4a40f420593ed19b4abbb64f24 to your computer and use it in GitHub Desktop.
routes for react-ssr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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