HiveBrain v1.2.0
Get Started
← Back to all entries
patternjavascriptreactCritical

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

Submitted by: @import:stackoverflow-api··
0
Viewed 0 times
jsxwhenscopereactmustusing

Problem

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(
            hello Tech View
        );
    }
}

export default TechView;


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

Solution

The import line should be:

import React, { Component } from 'react';


Note the uppercase R for React.

Context

Stack Overflow Q#42640636, score: 640

Revisions (0)

No revisions yet.