Here is the full error;
Type error: 'Component' cannot be used as a JSX component. Its element type 'ReactElement<any, any> | Component<{}, any, any>' is not a valid JSX element.
<Loader />
) : (
getLayout(<Component {...pageProps} />)
^
)
}
</AuthConsumer>
error Command failed with exit code 1.
I have read similar questions and posts about this "component cannot be used as a JSX component" and they have not helped me on my quest to move forward.
Versions: react, @types/react, @types/react-dom, all set to version 17.0.2
I have deleted the package-lock.json files and left only the yarn-lock.json files for now
What clue am I missing to solve this puzzle?
kind regards
The Issue is with Latest Version of @types/react:18.xx This may have been introduced to your project via some other packages' peer dependency.
If you have a .tsconfig file, Add following to compilerOptions:
"paths": {
"react": [ "./node_modules/@types/react" ]
},
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.