-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prevent React hook call warnings when used with MDX (#8324)
Co-authored-by: Nate Moore <[email protected]>
- Loading branch information
1 parent
8fff0e9
commit 0752cf3
Showing
6 changed files
with
54 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
'astro': patch | ||
--- | ||
|
||
Prevent React hook call warnings when used with MDX | ||
|
||
When React and MDX are used in the same project, if the MDX integration is added before React, previously you'd get a warning about hook calls. | ||
|
||
This makes it so that the MDX integration's JSX renderer is last in order. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 4 additions & 1 deletion
5
packages/integrations/mdx/test/fixtures/mdx-plus-react/src/components/Component.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
import { useState } from "react"; | ||
|
||
const Component = () => { | ||
return <p>Hello world</p>; | ||
const [name] = useState('world'); | ||
return <p>Hello {name}</p>; | ||
}; | ||
|
||
export default Component; |
3 changes: 3 additions & 0 deletions
3
packages/integrations/mdx/test/fixtures/mdx-plus-react/src/pages/post.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Testing | ||
|
||
This works! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters