I am using Parcel to build my React app. It’s throwing a syntax error: unexpected token.
HTML:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<link rel="stylesheet" href="./style.css">
</head>
<body>
<div id="root">not rendered</div>
<script type="text/babel" src="./App.js"></script>
</body>
</html>
App.js
import React from 'react';
import { render } from 'react-dom';
import { Pet } from './Pet';
const App = () => {
return (
<div>
<h1 class="heading">Adopt Me!</h1>
<Pet name="Luna" animal="Dog" breed="Havanese" />
<Pet name="Pepper" animal="Bird" breed="Cockaitiel" />
<Pet name="Doink" animal="Cat" breed="Mixed" />
</div>
);
};
render(<App />, document.getElementById('root'));
Error shown by Parcel in terminal:
I looked at this post but it didn’t work for me. How can I fix this?