I have my application created in create-react-app. when I go to the path / "users / create" the page remains the component of the path users ("users") on the screen and the component is not deleted When reloading the path page ("users / create") it works for me perfectly
I send screenshots of the code
-Routes
function App() {
return (
<LoginState>
<AlertState>
<DashboardState>
<DocumentState>
<UsersState>
<RelasesState>
<Router>
<Switch>
<Route exact path="/login" component={Login}/>
<Route exact path="/reset-pwd" component={ResetPwd}/>
<div className="wrapper">
<Header />
<div className="main-panel">
<RoutePrivate exact path="/" component={Dashboard}/>
<RoutePrivate exact path="/documents" component={Documents}/>
<RoutePrivate exact path="/document/:id" component={Document}/>
<RoutePrivate exact path="/usuarios" component={Users}/>
<RoutePrivate exact path="/usuarios/:userId" component={Users}/>
<RoutePrivate exact path="/usuarios/create" component={NewUser}/>
<RoutePrivate exact path="/usuarios/show/:id" component={User}/>
<RoutePrivate exact path="/usuarios/edit/:id" component={EditUser}/>
<RoutePrivate exact path="/comunicados" component={Relases}/>
<RoutePrivate exact path="/comunicados/:id" component={Relases}/>
<RoutePrivate exact path="/comunicados/send-email/:id" component={Relase}/>
<RoutePrivate exact path="/docslab" component={DocsLab} />
</div>
<Sidebar />
</div>
</Switch>
</Router>
</RelasesState>
</UsersState>
</DocumentState>
</DashboardState>
</AlertState>
</LoginState>
);
}
export default App;
"/usuarios" enter image description here
When changing from the page itself with a link to "create/users" it returns the previous component and below the new one enter image description here
I have noticed that when I remove the dynamic path from "/usuarios/:userId" everything works fine for me, what do you think I have done wrong? Thank you very much for your support.