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
426 views
in Technique[技术] by (71.8m points)

reactjs - why am I getting unexpected token error in react project in header.js?

Working on a small training project , and I keep getting syntax error which I do not understand. Please see the errors below:

./src/components/Header.js
SyntaxError: E:REACT_APPdrf_projectsrccomponentsHeader.js: Unexpected token, expected ";" (40:7)

  38 | }
  39 | 
> 40 | Export default Header;
     |        ^
  41 | 

Header.js

import React from 'react';
import AppBar from '@material-ui/core/AppBar';
import Toolbar from '@material-ui/core/ Toolbar';
import Typography from '@material-ui/core/ Typography';
import CssBaseLine from '@material-ui/core/CssBaseLine';
import { makeStyles } from '@material-ui/core/Styles';


const useStyles = makeStyles((theme) => ({
                appBar: {
                  borderBottom: `1px solid ${theme.palette.divider}`,
                },
}));

function Header() {

    const classes = useStyles();
    return (
    <React.Fragment>
      <CssBaseLine />
        <AppBar

          Position='static'
          Color='white'
          Elevation={0}
          className={classes.appBar}
        >

          <Toolbar>
            <Typography variant='6' color='inherit' noWrap>
              BlogmeUp
            </Typography>
          </Toolbar>

        </AppBar>
    </React.Fragment>
  );
}

Export default Header;

I keep looking for the root cause, yet no success, though I am following exactly the way its been shown in a tutorial. Could you please let me know the issue here?

question from:https://stackoverflow.com/questions/65901364/why-am-i-getting-unexpected-token-error-in-react-project-in-header-js

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

1 Answer

0 votes
by (71.8m points)

Do not use comma ,

 </React.Fragment>

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

...