RevereCRE/relay-nextjs

nested dynamic routes - how to get the right variable

philipbalbas opened this issue · 2 comments

I have this route /chapter/[chapterSlug]/topic/[topicSlug] however the preloadedQuery passes both the chapterSlug and topicSlug to the query. How do I make it so that only topicSlug is passed.

Configuring variablesFromContext on that page should do the trick!

Something like:

export default withRelay(MyPage, {
  /* ... */
  variablesFromContext: ctx => ({ topicSlug: ctx.query.topicSlug }),
});

thanks that did the trick