React prompts that XXX cannot be used as a JSX component

1. In the company's project, multiple pages reported errors. After development, it was found that it had no effect on the page, and it has not been processed. Later, when it was processed again, the problem was not found. I found the post on CSDN and used the following method to solve it file error

At this time, I found that the component I packaged still indicated that "xxx" could not be used as a JSX component. Later, I checked and found that the reason was that ts did not match the version of @types/react, and the prompt reported an error due to the version problem. You can check the @ in your project. types/react version and ts version to replace,

Query the local ts version

npm view typescript version

Query the local @types/react version

Check in the package.json file

 Reason for error https://www.npmjs.com/package/@types/react?activeTab=versions

Guess you like

Origin blog.csdn.net/weixin_72237725/article/details/129360579