Needs documentation for how to use new JSX transform
See original GitHub issueSummary
React says that Gatsby 2.24.+ supports the new JSX transform (and there’s a merged PR here claiming it is supported) so we don’t need to import * as React from 'react'
anymore for React 17. So I started a new Gatsby project (2.26.x). It installed React 16.x, which doesn’t support the new transform. I updated react
and react-dom
to 17.0.1 and removed the import * as React from 'react'
line from src/pages/index.js
and now I get a bunch of
101:5 error 'React' must be in scope when using JSX react/react-in-jsx-scope
for that file.
Motivation
It should be documented because React and Gatsby both claim to support this for React 17, but there do not seem to be instructions for how to make this work.
Steps to resolve this issue
Hell if I know. I’ve been trying to get this to work for a couple days now. Once it’s working, I’m going to try to get it working with TypeScript, which I also failed to get working the past day.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:7 (3 by maintainers)
Top GitHub Comments
@Austaras https://www.gatsbyjs.com/docs/reference/config-files/gatsby-config/#jsxruntime
@wardpeet any progress or roadmap yet?