nested dynamic routes - how to get the right variable
philipbalbas opened this issue · 2 comments
philipbalbas commented
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.
rrdelaney commented
Configuring variablesFromContext
on that page should do the trick!
Something like:
export default withRelay(MyPage, {
/* ... */
variablesFromContext: ctx => ({ topicSlug: ctx.query.topicSlug }),
});
philipbalbas commented
thanks that did the trick