Flow version: 0.136.0
I should be allowed to use JSX without importing React, as described by the React blog post:
https://reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html#flow
Cannot resolve name `React`. [cannot-resolve-name]
I was informed on Discord that there's an option to enable to make Flow understand the new JSX transform.
[options]
react.runtime=automatic
I can't find it documented anywhere in the docs though.
It's documented: https://flow.org/en/docs/config/options/#toc-react-runtime-automatic-classic
But it doesn't seem to work with focus-check.
Deleting babel from the Package.json
"babel": {
"presets": [
"react-app"
]
}
and creating a new babel.config.json file in the root directory of the project with the following code in it worked for me:
{
"presets": [
["@babel/preset-react", {
"runtime": "automatic"
}]
]
}
Why do we need to set it to automatic? The docs say:
The default value is automatic.