Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
322 views
in Technique[技术] by (71.8m points)

reactjs - why am I getting syntax error for REACT project?

I am working on some dummy project in REACT js, and while following certain tutorials I am errors which I am not able to rectify, Below is the error:

Failed to compile
./src/index.js
SyntaxError: E:REACT_APPdrf_projectsrcindex.js: Unexpected token, expected ";" (10:6)

   8 | import Footers from './components/Footers';
   9 | 
> 10 | Const routing = (
     |       ^
  11 |     <Router>
  12 |       <React.StrictMode>
  13 |       <Header />
This error occurred during the build time and cannot be dismissed.

Below is the index.js

import React from 'react';
import ReactDOM from 'react-dom';
import * as serviceWorker from './serviceWorker';
import './index.css';
import { Route, BrowserRouter as Router, Switch } from 'react-router-dom';
import App from './App';
import Header from './components/Header';
import Footers from './components/Footers';

Const routing = (
    <Router>
      <React.StrictMode>
      <Header />
        <Switch>
          <Route exact path='/' component={App} />
        <Switch>


      <Footer />
        </React.StrictMode>
    </Router>
);

ReactDOM.render(routing, document.getElementById('root'));
serviceWorker.unregister();

Based on the error, I have tried looking again and again but no success. Please suggest.

question from:https://stackoverflow.com/questions/65901067/why-am-i-getting-syntax-error-for-react-project

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

hey its const not Const just a typo


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...