Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Jul 6, 2025. It is now read-only.

Props as nested routes named export #440

Discussion options

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.

You must be logged in to vote

Variables specified in ssrProps of ssr could be referenced from page component.

Replies: 1 comment

Comment options

Variables specified in ssrProps of ssr could be referenced from page component.

You must be logged in to vote
0 replies
Answer selected by TomokiMiyauci
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet
1 participant

AltStyle によって変換されたページ (->オリジナル) /