I was able to extend this out a bit with getStaticProps and getStaticPaths:
export async function getStaticPaths(ctx) { const client = await apolloClient(ctx) const response = await client.query({ query: ALL_CHARACTER_IDS }) const { count } = response.data.characters.info; const ids = [...Array(count).keys()]; const paths = ids.map(id => ({ params: { id: `${id + 1}` }, })) return { paths, fallback: true } } export async function getStaticProps({ params }, ctx) { const client = await apolloClient(ctx) const response = await client.query({ query: GET_CHARACTER, variables: {id: `${params.id}`} }) const { character } = response.data; return { props: { character, loading: response.loading, error: !response.error ? null : response.error } }
Build time takes a bit but otherwise nice.
Thanks, that was useful!
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I was able to extend this out a bit with getStaticProps and getStaticPaths:
Build time takes a bit but otherwise nice.
Thanks, that was useful!