0

This is my error

Error in ./src/App.js Syntax error: Unexpected token (11:5)

9 | 10 | return (

11 | <> | ^ 12 |
13 | 14 |

@ ./src/index.js 13:11-27

Here is my app.js file

import React from 'react';
import { CssBaseline, Grid } from '@material-ui/core';

import Header from './components/Header/Header';
import List from './components/List/List';
import Map from './components/Map/Map';

const App = () => {

  return (
    <>
   
        <CssBaseline/>
        <Header />
        <Grid container spacing={3} style={{ width: '100%'}}>
            <Grid item xs={12} md={4}>
              <List />
            </Grid>
            <Grid item xs={12} md={8}>
              <Map />
            </Grid>
        </Grid>

    </>
  );
}

export default App;

it is my app.js file

5
  • 2
    Seems like you have a syntax error at your fragment shorthand <> – try replacing that with the longhand notation <React.Fragment> and the closing tag </React.Fragment> Commented Apr 13, 2022 at 16:20
  • 1
    What is your react version?
    – Liki Crus
    Commented Apr 13, 2022 at 16:23
  • @LikiCrus version 8.5,5
    – Noob_Gamer
    Commented Apr 13, 2022 at 16:35
  • @Noob_Gamer I meant React version. Please show your package.json
    – Liki Crus
    Commented Apr 13, 2022 at 16:38
  • @LikiCrus actually Mikes solution worked for me but I dont understand the problem and how it solved it?
    – Noob_Gamer
    Commented Apr 13, 2022 at 16:52

1 Answer 1

1

Use React.Fragment instead of <>.

I would think your babel plugin doesn't understand <></> because of old version.

Not the answer you're looking for? Browse other questions tagged or ask your own question.