briancodex / react-navbar-v3 Goto Github PK
View Code? Open in Web Editor NEWCreated a simple React Navbar with 3 different variations
Created a simple React Navbar with 3 different variations
In the video, you utilized:
<Switch>
<Route path='/' exact component={Home} />
<Route path='/about' component={About} />
<Route path='/services' component={Services} />
<Route path='/contact-us' component={Contact} />
<Route path='/sign-up' component={SignUp} />
</Switch>
But I got some errors when compiling it: Attempted import error: 'Switch' is not exported from 'react-router-dom'
After investigating a little bit, I found that since v6 of react-router-dom, Switch is replaced by Routes, making this change on my project solved the issue:
import { BrowserRouter as Router, Routes, Route } from 'react-router-dom';
...
<Routes>
<Route path='/' element={<Home/>} />
<Route path='/about' element={<About/>} />
</Routes>
I think it would be nice if you pinned a comment on the video or to update it.
Thanks for the tutorial.
Fix correction:
1 - in package.json
Change start script to: "start": "react-scripts --openssl-legacy-provider start"
2 - Enable legacy OpenSSL provider.
On Unix-like (Linux, macOS, Git bash, etc.):
export NODE_OPTIONS=--openssl-legacy-provider
On Windows command prompt:
set NODE_OPTIONS=--openssl-legacy-provider
On PowerShell:
$env:NODE_OPTIONS = "--openssl-legacy-provider"
This repo is missing react-router-dom dependency in package.json
Probably just a typo.
Simply run:
yarn add react-router-dom
Cheers!
all code i do with ur youtube video but cant display any navbar in a browser.what is the problem why its not show the output can u help me out?
Line 15 in 642eefd
Just to let others (apprentices like me) know about that change. Here is the reference so you can solve that problem. Thank you very much for your video, I have learned a lot. https://stackoverflow.com/questions/69854011/matched-leaf-route-at-location-does-not-have-an-element
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.