I am working with react 18 in typescript. However, apart from react and react-dom, I also see types/react and types/react-dom libraries in package.json. What is the purpose of these libraries?
The ones with @types prefix are type declaration packages.
It is most commonly found in React Typescript. As in Typescript, we have to define types of variables. So when we use React with Typescript, we use types/react to declare the type of the React library and types/react-dom to declare the type of the React-dom library.
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.