Reputation: 86
I am a beginner learning react and I recently used the CRA 4.0.0 boilerplate where I noticed that we don't need to import react anymore, I have this question that, how was the CRA developer team able to implement this change ?
Upvotes: 0
Views: 256
Reputation: 7574
The React team switched to a new, more generic JSX transform (transpiling your JSX-Components into function calls) with a stricter naming convention. This allows transpilers/compilers like Babel or TypeScript to inject the transform on compile, rather than you having to specify it for each component. See https://reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html
In theory, this should help to make components easier transportable between frameworks. However, the moment you need a hook or similar, you need to import that hook from the React package again.
Upvotes: 2