UNPKG

react-static

Version:

A progressive static site generator for React

31 lines (29 loc) 564 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: '/', }, { path: '/about', }, { path: '/blog', getData: () => ({ posts, }), children: posts.map(post => ({ path: `/post/${post.id}`, getData: () => ({ post, }), })), }, ] }, }