I am an Angular developer and new to React. This is a simple React component, but it doesn't work.
import react, { Component } from 'react'; import { render } from 'react-dom'; class TechView extends Component { constructor(props){ super(props); this.state = { name:'Gopinath' } } render(){ return( <span>hello Tech View</span> ); } } export default TechView;
mistake: When using JSX, 'React' must be in scope react/react-in-jsx-scope
Add the following settings in
.eslintrc.js
/.eslintrc.json
to ignore these errors:Why? If you are using
NEXT.js
, there is no need to importReact
at the top of the file, nextjs will do it for you.Reference: https://gourav.io/blog/nextjs-cheatsheet(Next.js cheatsheet)
The import line should be:
Note the capital R in React.