Skip to content

Not support export const a = props.a #2075

Answered by wooorm
gutenye asked this question in Q&A
Discussion options

You must be logged in to vote

Yes. Import/export statements are a level higher than the content. You can’t pass props to them. To illustrate, say this is file.mdx:

export const a = 1

{props.b}

And this is the code using it:

import {default as MDXContent, a} from './path/to/file.mdx'

// `MDXContent` is a function, so sure, we could pass props to them and set `b`.
// But `a` is the value `1`, it’s already exported, we can’t change that.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by gutenye
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants