-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Assign props at the top level of render #326
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -105,10 +105,10 @@ function toJSX(node, parentNode = {}, options = {}) { | |
| } class MDXContent extends React.Component { | ||
| constructor(props) { | ||
| super(props) | ||
| this.layout = ${layout} | ||
| this.layout = ${layout || 'null'} | ||
| } | ||
| render() { | ||
| const { components = {} } = this.props | ||
| const { components = {}, ...props } = this.props | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. won't this need an equivalent change in the runtime to pass the props into createElement? Previously, the runtime was just using the scoped names when passed in to defined the createElement(MDXContent, {components, ...props}) |
||
|
|
||
| return <MDXTag | ||
| name="wrapper" | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could also remove the entire constructor instead if layout isn't defined.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is semantically cleaner than omitting the constructor entirely, because it's communicating that there is no user layout.
nullis semantically different thanundefined.