Using React Router 4

Using Switch

Using Switch

Let's add a page to add a user. This should be pretty easy, right? Inside src/fe/components/Cms/index.js, let's add a new route that will render our UserAdd component when the URL matches /users/new.

import UserAdd from '../UserAdd';


<Route path="/users" component={Users} />
<Route path="/users/new" component={UserAdd} />

We have simply added a route under the route we already had in there. Load up the application in the browser and visit /users/new.

Well...ummm...WAT? Why is the users table still showing in the background? And why is the modal up? We can see the user add form under the modal too. It displayed them all!