I am trying to find the most elegant way to implement <head>
into my react app. Idea is to structure the code like so:
function App() {
return (
<div>
<Head />
<div className="App">
<Header />
<Body />
<Footer />
</div>
</div>
);
}
My Head:
import React from 'react';
import { Helmet } from 'react-helmet';
export const Head = () => {
return (
<Helmet>
<meta http-equiv="x-ua-compatible" content="ie=edge"/>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"/>
<meta name="format-detection" content="telephone=no"/>
<meta charset="utf-8"/>
<meta name="description" content=""/>
<title>Timesheet APP</title>
<meta name="robots" content="noindex,nofollow"/>
<meta name="googlebot" content="noindex,nofollow"/>
<link href="./favicon.ico" rel="icon" />
</Helmet>
)
}
But I keep on getting the error:
./src/Head.js
Module not found: Can't resolve '..react-timesheet-app\node_modules\react-scripts\node_modules\babel-loader\lib\index.js' in '..react-timesheet-app'
First of all is the idea behind my project structure even right? Second why do I keep on getting the error?
Edit: Added my
My Package.json:
{
"name": "react-timesheet-app",
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-helmet": "^6.1.0",
"react-scripts": "4.0.2",
"web-vitals": "^1.0.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}