Skip to content

Update App.js: React Router Dom new Version #51

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Sheharyark
Copy link

Here,
#I changer the routes according to the new version of react router dom
in react-router-dom v6, "Switch" is replaced by routes "Routes". You need to update the import from
##import { Switch, Route } from "react-router-dom";

to

##import { Routes ,Route } from 'react-router-dom';
You also need to update the Route declaration from

##

to

##<Route path='/welcome' element={} />

In react-router-dom, you also do not need to use the exact in the Route declaration.

Here,
#I changer the routes according to the new version of react router dom
in react-router-dom v6, "Switch" is replaced by routes "Routes". You need to update the import from
import { Switch, Route } from "react-router-dom";
to

import { Routes ,Route } from 'react-router-dom';
You also need to update the Route declaration from

<Route path="/" component={Home} />
to

<Route path='/welcome' element={<Home/>} />
In react-router-dom, you also do not need to use the exact in the Route declaration.
@Sheharyark
Copy link
Author

#I changer the routes according to the new version of react router dom

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant