Props as nested routes named export #440
Answered
by
TomokiMiyauci
TomokiMiyauci
asked this question in
Ideas
-
I want to receive named exports of nested routes(children) as props in the parent. .
├── docs
│ └── get-started.tsx
└── docs.tsx // get-started.tsx
export default function GetStarted() {
return <h1></h1>
}
export const title = "Get Started" // docs.tsx
export default function Docs(props) {
if (props.Page) {
// I want to get child named export via
// props.pageProps.title or
// props.title
return <props.Page />
}
return <></>
} Currently, you can only get the properties assigned to the default export function. If this can be done, it will be very easy to use with For example, here is the file // pages/docs/installation.mdx
---
title: hello
---
# hello The conversion to MDX 2 looks like this (Also converts front matter) export const title = "hello"
function MDXContent() {
...
}
export default MDXContent It would be nice if we could get |
Beta Was this translation helpful? Give feedback.
Answered by
TomokiMiyauci
Mar 1, 2022
Replies: 1 comment
-
Variables specified in |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
TomokiMiyauci
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Variables specified in
ssrProps
ofssr
could be referenced from page component.