This repository was archived by the owner on Jul 6, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 166
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 mdx.
I have published aleph-plugin-mdx.
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 title as props at the parent layout page component.
Beta Was this translation helpful? Give feedback.
All reactions
Answered by
TomokiMiyauci
Mar 1, 2022
Variables specified in ssrProps of ssr could be referenced from page component.
Replies: 1 comment
-
Variables specified in ssrProps of ssr could be referenced from page component.
Beta Was this translation helpful? Give feedback.
All reactions
0 replies
Answer selected by
TomokiMiyauci
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment