It is very know well the shape how we import react, but however there are issues by doing this
import React from 'react'
import * as React from 'react'
Yes well works how we want, the problem that exists with the two shape are the next's
The first imported
import React from 'react'
What happens?
is that are importing all the Library. And the problem is what we re making a importing heavy. Which can produce issues for example a low yield.
The second imported
import * as React from 'react'
What happens is that we re making same. We re Saying what all the Library Be imported how react
These complet imports, are inncesary and we re Hurting our development
So there are a way which Fix these?
Yes and is import the necessary, how in this example
import {useState, useContext } from 'react'
But so. How Compiled our JSX?
Remember That babel exists and compile our JSX.
In the doc of react, We are told that react JSX is alone sugar for call to react create element
But We must import createElement?
No. since react use babel which Recognizes our JSX and does not need an import
Top comments (0)