I'm trying to build simple page with nav, footer and component between them which content should be rendered depends of nav. Unfortunately only Home works fine (Nav and Footer are present). When I click to any other link in nav, Gatsby render just component with content without Nav and Footer (for instance just AboutUs).
My index.js code:
import React from "react";
import { Router } from "@reach/router";
{* import of other components *}
const App = () => (
<div>
<Nav />
<Router>
<Home path="/" />
<AboutUs path="about" />
<Projects path="projects" />
<Join path="join" />
<Contact path="contact" />
</Router>
<Footer />
</div>
);
export default App;
And my Nav.js components looks like that:
import React from "react";
import { Link } from "gatsby";
import logo from "./assets/logoMain.svg";
const Nav = () => {
const navNames = [
{ text: "about us", link: "about" },
{ text: "incoming trips", link: "travels" },
{ text: "join us", link: "join" },
{ text: "contact", link: "contact" },
];
const navLinks = navNames.map((item) => (
<Link to={item.link} key={item.link}>
<span>{item.text}</span>
</Link>
));
return (
<header>
<Link to="./">
<img src={logo} alt="Logo" />
</Link>
<div>{navLinks}</div>
</header>
);
};
export default Nav;