Reputation: 1627
I get the error index.pack.js:1 Uncaught SyntaxError: Unexpected token '<' I thought this was an error I made but no, i cant seem to find any errors, Here's the code for what i have got
Index.html
<html>
<head>
<link href="https://fonts.googleapis.com/css?family=Oswald&display=swap" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/[email protected]/fonts/remixicon.css" rel="stylesheet">
<link rel="stylesheet" href="styles.css">
</head>
<body>
<div id="root"></div>
<script src="index.pack.js"></script>
</body>
</html>
Then index.js
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
ReactDOM.render(
<React.StrictMode>
<App />
</React.StrictMode>,
document.getElementById('root')
);
Also then in the app
import React from "react"
function App() {
return (
<div>
<h1>Home Page</h1>
</div>
)
}
export default App
FYI< I have installed create-react-app and deleted some of those files > Any help would be appreciated! Here's the error when inspected
Upvotes: 0
Views: 995
Reputation: 21
I fixed this by going into my index.html file (in visual studio code) and holding ctrl click on the index.pack.js link inside the tags. Visual studio code will come up with an error saying file cannot be found, would u like to create it? select yes, save and refresh your page. For me this was enough and my code worked perfectly error free.
Upvotes: 2
Reputation: 11
I fixed this by going into my index.html file (in visual studio code) and holding ctrl click on the index.pack.js link inside the tags. Visual studio code will come up with an error saying file cannot be found, would u like to create it? select yes, save and refresh your page. For me this was enough and my code worked perfectly error free.
Upvotes: 1