bulletproof-react
bulletproof-react copied to clipboard
'Helmet' cannot be used as a JSX component.
After cloning and installing dependencies with yarn, I face this error . Is there any way to fix it?
npm version: 8.5.0 node version: v16.14.2
'Helmet' cannot be used as a JSX component.
Its instance type 'Helmet' is not a valid JSX element.
The types returned by 'render()' are incompatible between these types.
Type 'React.ReactNode' is not assignable to type 'import("/Users/sayinmehmet47/Desktop/projeler\u2705/bulletproof-react/node_modules/@testing-library/react-hooks/node_modules/@types/react/index").ReactNode'.
Type '{}' is not assignable to type 'ReactNode'. TS2786
8 | export const Head = ({ title = '', description = '' }: HeadProps = {}) => {
9 | return (
> 10 | <Helmet
| ^
11 | title={title ? `${title} | Bulletproof React` : undefined}
12 | defaultTitle="Bulletproof React"
13 | >
I had the same problem. I added those 2 "@types" lines to "resolutions" section at package.json.
"resolutions": { "babel-loader": "8.1.0", "@types/react": "17.0.2", "@types/react-dom": "17.0.2" },
I also deleted node_modules folder and yarn.lock file, and rerun yarn install command. Now "x is not a valid JSX element" errors are gone.
But still there are 3 files with TypeScript errors. I added // @ts-nocheck
to the top of those files, after that finally the project opened on localhost. But registering a user is unsuccessful.
This project hasn't been updated for a long time, I guess it's not stable anymore.