0

I am in a component whose URL is

http://localhost:3000/dashboard/profile/timeline/abcd

and the route is set up as

<Route path="/dashboard/profile/:screenId/:userId" component={this.Routing}/>

When I go to a different profile for e.g.

http://localhost:3000/dashboard/profile/timeline/xyz

It is not routing but the url is changing

Any suggestion would be helpful

Saurav Dutta
  • 63
  • 2
  • 10

1 Answers1

0

replace component={this.Routing} with component={Routing}

<Route exact path="/dashboard/profile/:screenId/:userId" component={Routing}/>

React : difference between <Route exact path="/" /> and <Route path="/" />

if your problem not resolve use Switch I have this problem too and i resolve with Switch

import {BrowserRouter, Route, Switch} from "react-router-dom";
.
.
.
.

        <BrowserRouter>
          <Switch>
              <Route exact key="1" path="/dashboard/profile/:screenId/:userId" component={Routing}/>
          </Switch>
        </BrowserRouter>