Skip to content

How to dev with prerender-data-provider? #1802

Answered by rschristian
orangecoloured asked this question in Q&A
Discussion options

You must be logged in to vote

Here's a screencast. I'm refreshing the page being on /graphics but the url in the props is /.

That looks like you're not prerendering /graphics then.

Can you provide a reproduction? It's hard to diagnose an issue that I cannot see.

From my understanding that's how we use the data from the provider in different routes.

That's one way to use it, sure. Just need a slight modification to a route to use it:

// src/routes/home/index.js
import { usePrerenderData } from '@preact/prerender-data-provider';

const Home = (props) => {
    const [value] = usePrerenderData(props);
    ...
}

value will then have your prerender data for that route. props will come from the router, but just needs to …

Replies: 1 comment 16 replies

Comment options

You must be logged in to vote
16 replies
@rschristian
Comment options

@rschristian
Comment options

@orangecoloured
Comment options

@rschristian
Comment options

Answer selected by orangecoloured
@orangecoloured
Comment options

@rschristian
Comment options

@rschristian
Comment options

@orangecoloured
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants