UNPKG

react-static

Version:

A progressive static site generator for React

39 lines (37 loc) 814 B
import axios from 'axios' export default { getSiteData: () => ({ title: 'React Static', }), getRoutes: async () => { const { data: posts } = await axios.get('https://jsonplaceholder.typicode.com/posts') return [ { path: '/', component: 'src/containers/Home', }, { path: '/about', component: 'src/containers/About', }, { path: '/blog', component: 'src/containers/Blog', getData: () => ({ posts, }), children: posts.map(post => ({ path: `/post/${post.id}`, component: 'src/containers/Post', getData: () => ({ post, }), })), }, { is404: true, component: 'src/containers/404', }, ] }, }