I created a stateless component and called it. The result was an error: React is not defined. As a result, if I added import React from 'react' before defining the stateless component, the error would not be reported.
import React from 'react'
export default props=><p>123123123</p>
import HasNoState from './HasNoState'
<HasNoState />
You thought you didn’t use React.
But when jsx is parsed into js, React needs to be called, so if you don’t introduce React here, you will naturally get an error.
<HasNoState /> This way of instantiating components is a syntactic sugar encapsulated by react. To use it, react must be introduced in the scope.
React Must Be in Scope...
I suggest you go to the official documentation to take a closer look. Look, the part about jsx
https://facebook.github.io/re...