Props as nested routes named export #440
-
|
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
---
# helloThe conversion to MDX 2 looks like this (Also converts front matter) export const title = "hello"
function MDXContent() {
...
}
export default MDXContentIt would be nice if we could get |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
Variables specified in |
Beta Was this translation helpful? Give feedback.
Variables specified in
ssrPropsofssrcould be referenced from page component.