JavaEar 专注于收集分享传播有价值的技术资料

'React' must be in scope when using JSX react/react-in-jsx-scope?

I am an Angular Developer and new to React , This is simple react Component but not working

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;

Error : 'React' must be in scope when using JSX react/react-in-jsx-scope

1个回答

    最佳答案
  1. It should be:

    import React, { Component} from 'react';

    Note the uppercase R.