-
I put below code to https://mdxjs.com/playground/, but it doesn't work. import { useState } from 'react'
export const MyDynamicButton = () => {
const [count, setCount] = useState(0)
return (
<button onClick={() => setCount(count + 1)}>Clicked {count} times!</button>
)
}
Click it! <MyDynamicButton /> Then I try to replace How should I do to make it works? (just use |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
That works. You can use that fine “in React”. But not on our playground. The reason is that the website has a packaged version of React, which renders the result of the playground. And you include a different React from within the MDX “file”. Both work fine, until React notices a different React. And React doesn’t support that. |
Beta Was this translation helpful? Give feedback.
That works. You can use that fine “in React”.
But not on our playground.
The reason is that the website has a packaged version of React, which renders the result of the playground. And you include a different React from within the MDX “file”. Both work fine, until React notices a different React. And React doesn’t support that.