Our new router, which is being directly loaded from index.js
This commit is contained in:
		
							
								
								
									
										25
									
								
								client/app/Root.jsx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								client/app/Root.jsx
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,25 @@ | ||||
| import React, { Component } from 'react'; | ||||
| import { HashRouter as Router, Route, Switch, IndexRoute } from 'react-router-dom'; | ||||
|  | ||||
| import SearchRequest from './components/SearchRequest.jsx'; | ||||
| import AdminComponent from './components/admin/Admin.jsx'; | ||||
|  | ||||
| class Root extends Component { | ||||
|  | ||||
|   // We need to provide a list of routes | ||||
|   // for our app, and in this case we are | ||||
|   // doing so from a Root component | ||||
|   render() { | ||||
|     return ( | ||||
|       <Router> | ||||
|         <Switch> | ||||
|           <Route exact path='/' component={SearchRequest} /> | ||||
|           <Route path='/admin/:search' component={AdminComponent} /> | ||||
|           <Route path='/admin' component={AdminComponent} /> | ||||
|         </Switch> | ||||
|     </Router> | ||||
|     ); | ||||
|   } | ||||
| } | ||||
|  | ||||
| export default Root; | ||||
		Reference in New Issue
	
	Block a user