Since 5.7.2: Using JSX fragments requires fragment factory 'React' to be in scope, but it could not be found. #60603
Labels
Needs Investigation
This issue needs a team member to investigate its status.
π Search Terms
Search/Keywords: Using JSX fragments requires fragment factory 'React' to be in scope, but it could not be found.
π Version & Regression Information
Since 5.7.2. No 5.7.0 or 5.7.1 available. OK in 5.6.3
β― Playground Link
Best effort Playground
π» Code
π Actual behavior
Since TS 5.7.2 JSX Fragments are no longer accepted.
Compile error: error TS2879: Using JSX fragments requires fragment factory 'React' to be in scope, but it could not be found.
π Expected behavior
JSX Fragments should continue to work
Additional information about the issue
I have a custom JSX setup, I'm not using React.
babel-preset-react
is used to transform JSX. This grabsFragment
from the JSX runtime provided and passes this as the node type when creating the element via the JSX runtime. It has been working since TS 4 until now.Compiled output:
The error message about React is odd, JSX and React are independent, why would React anything be needed to use JSX fragments?
babel-preset-react
withruntime: "automatic"
loads jsx functions and theFragment
constant from a specified JSX runtime and does not rely on anything calledReact
.The text was updated successfully, but these errors were encountered: