-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Description
It would be neat if MDX automatically passed all named exports to the default exported layout component. For example, right now I have to do the following:
import BlogPost from '../../components/BlogPost';
export const meta = {
published: true,
title: 'Tech Choices I Regret at Spectrum',
// ...more meta data...
}
export default ({ children }) => <BlogPost meta={meta}>{children}</BlogPost>It would be neat if I could do this instead and BlogPost would get meta passed as a prop automatically (on top of children of course):
import BlogPost from '../../components/BlogPost';
export const meta = {
published: true,
title: 'Tech Choices I Regret at Spectrum',
// ...more meta data...
}
export default BlogPost;That way, my BlogPost could have a getInitialProps method to fetch data with Next.js. Right now, I have to asynchronously fetch data in the componentDidMount lifecycle, which is not the best user experience.
johno
Metadata
Metadata
Assignees
Labels
No labels