Title: Since 5.7.2: Using JSX fragments requires fragment factory 'React' to be in scope, but it could not be found. · Issue #60603 · microsoft/TypeScript · GitHub
Open Graph Title: Since 5.7.2: Using JSX fragments requires fragment factory 'React' to be in scope, but it could not be found. · Issue #60603 · microsoft/TypeScript
X Title: Since 5.7.2: Using JSX fragments requires fragment factory 'React' to be in scope, but it could not be found. · Issue #60603 · microsoft/TypeScript
Description: 🔎 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 B...
Open Graph Description: 🔎 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 av...
X Description: 🔎 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...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/60603
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Since 5.7.2: Using JSX fragments requires fragment factory 'React' to be in scope, but it could not be found.","articleBody":"### 🔎 Search Terms\n\nSearch/Keywords: Using JSX fragments requires fragment factory 'React' to be in scope, but it could not be found.\n\n### 🕗 Version & Regression Information\n\nSince 5.7.2. No 5.7.0 or 5.7.1 available. OK in 5.6.3\n\n### ⏯ Playground Link\n\n[Best effort Playground](https://www.typescriptlang.org/play/?ssl=13&ssc=60&pln=11&pc=1#code/JYWwDg9gTgLgBAbzgZVGANgUwMIXBAO0wPgF84AzKPOAchgFcCBzAZxmNrgHpu4YAnmEysAXHAAMAOgCMUgKwyAsAChVmAB6RYcAMboAhq1ZwAMhGbNMAEwDyDeJo4FrJ1OCy58REolVwAvUJneABeOAAKAEo4UIA+SP9A5IAeBN44AEk4VkxMfgALfOQAUWxbADkAEThMKGooOCKofOACOBABWoIAN2BqAhBiGCTksbgUgpk480sbOHsYFO4p9L5sqsraABUcvMLgEzqGuDaOruI+gaGSUbHluLuo1VJVVQzdAoMWNuY4beQcB6dVYwEI-AgQIUUgAbFIAMx7TAgEwwSGfb5WQr5ADu0Gsv3efAgFGxlH67Fq9WgkQIEHg31OxgYrXanW6V0INxgUQANHBvtYBehWBAiXAWiAIMDUUU4AAxKAGZjcqkNflGU7wawQESnNkXXr9LnDVRAA)\n\n### 💻 Code\n\n```ts\n \u003c>\n \u003ch1>Logged Out\u003c/h1>\n \u003c/>\n```\n\n### 🙁 Actual behavior\n\nSince TS 5.7.2 JSX Fragments are no longer accepted.\n\nCompile error: error TS2879: Using JSX fragments requires fragment factory 'React' to be in scope, but it could not be found.\n\n### 🙂 Expected behavior\n\nJSX Fragments should continue to work\n\n### Additional information about the issue\n\nI have a custom JSX setup, I'm not using React. `babel-preset-react` is used to transform JSX. This grabs `Fragment` 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.\n\nCompiled output:\n```ts\nimport { jsx as _jsx, Fragment as _Fragment } from \"tungsten/jsxRuntime.js\";\n...\n _jsx(_Fragment, {\n children: _jsx(\"h1\", {\n children: \"Logged Out\"\n })\n })\n```\n\nThe error message about React is odd, JSX and React are independent, why would React anything be needed to use JSX fragments? `babel-preset-react` with `runtime: \"automatic\"` loads jsx functions and the `Fragment` constant from a specified JSX runtime and does not rely on anything called `React`.","author":{"url":"https://github.com/RobertSandiford","@type":"Person","name":"RobertSandiford"},"datePublished":"2024-11-26T05:04:33Z","url":"https://github.com/microsoft/TypeScript/issues/60603"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:5613305a-3d7d-5274-26aa-548bc2198d37 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 88AE:785A9:CE379E:1063A0A:6B0100AC |
| html-safe-nonce | 5ccc3bb51394745ae0ebfa747ca9990ad46b46b764adf8c0d16a419c6ac116f8 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4OEFFOjc4NUE5OkNFMzc5RToxMDYzQTBBOjZCMDEwMEFDIiwidmlzaXRvcl9pZCI6IjY3NjkxOTAzMDM2NjU1NTM1ODAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 08a52319ebdf036792b79b76036dc6f7e318c8004c9995ee45db5957f259a00f |
| hovercard-subject-tag | issue:2693132260 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/microsoft/TypeScript/60603/issue_layout |
| twitter:image | https://opengraph.githubassets.com/467b1747f59c27f2e22be6344281c49635f5a166267c89cc0d8bd298ba189d24/microsoft/TypeScript/issues/60603 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/467b1747f59c27f2e22be6344281c49635f5a166267c89cc0d8bd298ba189d24/microsoft/TypeScript/issues/60603 |
| og:image:alt | 🔎 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 av... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | RobertSandiford |
| hostname | github.com |
| expected-hostname | github.com |
| None | cb7fa109eca7d4156c889f474306b0e91336055e9adf8fd4684b61e49094d124 |
| turbo-cache-control | no-preview |
| go-import | github.com/microsoft/TypeScript git https://github.com/microsoft/TypeScript.git |
| octolytics-dimension-user_id | 6154722 |
| octolytics-dimension-user_login | microsoft |
| octolytics-dimension-repository_id | 20929025 |
| octolytics-dimension-repository_nwo | microsoft/TypeScript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 20929025 |
| octolytics-dimension-repository_network_root_nwo | microsoft/TypeScript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 2b59d31a4e44f08b7af67a4b67f8fd0af3befe2a |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width