Open oliviertassinari opened 1 month ago
Agreed. We can atleast start with our own docs, update the eslint rules, and then update the examples.
Vite (latest version) warn when starting a new project and copying and pasting our demos in the docs:
So there is a DX cost in having those react imports.
Next.js (latest version) doesn't say anything, it's happy with having import * as React from 'react'
or not having it.
Summary
See https://legacy.reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html#removing-unused-react-imports for context. Most of the demos in the docs could be written without the import of React.
This is also reflected in https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/react-in-jsx-scope.md.
Examples
Motivation
In the past, we didn't do the change because there was too many React users <17.0.0. But this seems to mostly OK now:
https://tools-public.mui.com/prod/pages/npmVersion?package=react
Search keywords: optional import react