1

I'm trying to figure out why my react code won't run. I just set up a router for linking in the Nav but now my render function won't render on any of the pages and I don't know why. Please check out the link to my Code Sandbox for reference code Sand box I would like my file to at least be running. I am using Bootstrap I don't think that is the issue though.

Error:(386, 23) TS2583: Cannot find name 'Set'. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later.

1 Answers1

0

Your navs are translated into pure <a href =""/> and they never use REACT-ROUTER-DOM, luckily react-bootstrap has thought about that

import { Link } from 'react-router-dom';

<Nav className="mr-auto">
   <NavItem href="/">
      <Nav.Link as={Link} to="/" >Home</Nav.Link>
   </NavItem>
</Nav>

You have a mess on the imports (i hope SandBox messed them up) ==> FIX pathsssssssssssssssss import App from "./components/App"; to import App from "./App";

at App.js (replace ../src to ./src) etcc

Renaldo Balaj
  • 2,390
  • 11
  • 23
  • ANDDD - your code doesn't run because of bad imports, create a new project and test the navs in the way i told you – Renaldo Balaj Nov 27 '19 at 00:15
  • 1
    what is wrong with my imports? can you place your references? – Zachary Blumstein Nov 27 '19 at 00:53
  • index.js is in the same directory with App.js, so you shouldn't use import App from "./components/App" to import it (you would use this if it was in the folder components), when they are in the same folder u use **./** Did you try my answer ? did it work for your needs ? – Renaldo Balaj Nov 27 '19 at 00:55
  • 1
    I will try your response give me a second. What page are you referencing above? – Zachary Blumstein Nov 27 '19 at 00:57
  • Try on a new project, USE create-react-app if it works feel free to upvote. [https://stackoverflow.com/questions/54843302/reactjs-bootstrap-navbar-and-routing-not-working-together] <== i found some new resources for you too – Renaldo Balaj Nov 27 '19 at 00:59
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/203139/discussion-between-zachary-blumstein-and-renaldo-balaj). – Zachary Blumstein Nov 27 '19 at 01:03
  • that repo did not link – Zachary Blumstein Nov 27 '19 at 01:06