-1

the code is as follows i am getting error

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

import {BrowserRouter as  Router, Routes, Route} from 'react-router-dom';
    
    function App() {
      return (
        <>
        <Router>
        <Navbar/>
        <Routes>
          <Route path= '/' exact />
          </Routes>
        </Router>
         
        </>
      );
    }
    
    export default App;

David
  • 5,882
  • 3
  • 33
  • 44
  • Does this answer your question? ['React' must be in scope when using JSX react/react-in-jsx-scope?](https://stackoverflow.com/questions/42640636/react-must-be-in-scope-when-using-jsx-react-react-in-jsx-scope) – Henry Woody Oct 23 '22 at 22:01

2 Answers2

2

Since you haven't provided the full code here, I assume that your React import statement is wrong. Import React on top of your .js file

import React from 'react';
1

Error came because you did not import React.

import react from 'react';

This import is required under React 17 And no more required since React 17