How to use the react-static/node.createSharedData function in react-static

To help you get started, we’ve selected a few react-static examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github react-static / react-static / examples / test-large / static.config.js View on Github external
getRoutes: async () => {
    const { data: posts } = await axios.get(
      'https://jsonplaceholder.typicode.com/posts'
    )

    const allPosts = []

    const sidebarInfo = createSharedData({
      foo: 'bar',
    })

    let i = 0
    while (i < routeSize) {
      i++
      const post = posts[i % posts.length]
      allPosts.push({
        ...post,
        id: i,
        body: `${post.body} ${i}`,
      })
    }

    return [
      ...(!process.env.PAGINATION
github react-static / react-static / packages / react-static / templates / stress-test / static.config.js View on Github external
getRoutes: async () => {
    const { data: posts } = await axios.get(
      'https://jsonplaceholder.typicode.com/posts'
    )

    const allPosts = []

    const sidebarInfo = createSharedData({
      foo: 'bar',
    })

    let i = 0
    while (i < routeSize) {
      i++
      const post = posts[i % posts.length]
      allPosts.push({
        ...post,
        id: i,
        body: `${post.body} ${i}`,
      })
    }

    return [
      ...(!process.env.PAGINATION