Last active
January 18, 2026 04:13
-
-
Save okoghenun/20d766a61fe8ea1c0ce189108681da97 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, { Component } from 'react'; | |
| import { Switch, Route } from 'react-router-dom'; | |
| import { Routes } from './config/routes'; | |
| import './App.css'; | |
| class App extends Component { | |
| render() { | |
| return ( | |
| <section> | |
| <Switch> | |
| {Routes.map((route, index) => [ | |
| <Route | |
| key={index} | |
| path={route.path} | |
| exact={route.exact} | |
| component={route.component} | |
| /> | |
| ])} | |
| </Switch> | |
| </section> | |
| ); | |
| } | |
| } | |
| export default App; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, { Component } from 'react'; | |
| import logo from '../logo.svg'; | |
| class About extends Component { | |
| render() { | |
| return ( | |
| <div className="App"> | |
| <header className="App-header"> | |
| <img src={logo} className="App-logo" alt="logo" /> | |
| <h1 className="App-title">About Page</h1> | |
| </header> | |
| <p className="App-intro"> | |
| Welcome to the about page :) | |
| </p> | |
| </div> | |
| ); | |
| } | |
| } | |
| export default About; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, { Component } from 'react'; | |
| import logo from '../logo.svg'; | |
| class Home extends Component { | |
| render() { | |
| return ( | |
| <div className="App"> | |
| <header className="App-header"> | |
| <img src={logo} className="App-logo" alt="logo" /> | |
| <h1 className="App-title">Home Page</h1> | |
| </header> | |
| <p className="App-intro"> | |
| Welcome to the home page :) | |
| </p> | |
| </div> | |
| ); | |
| } | |
| } | |
| export default Home; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Home from '../components/Home'; | |
| import About from '../components/About'; | |
| export const Routes = [ | |
| { | |
| path: '/', | |
| exact: true, | |
| component: Home | |
| }, | |
| { | |
| path: '/about-us', | |
| exact: false, | |
| component: About | |
| }, | |
| ]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from 'react'; | |
| import ReactDOM from 'react-dom'; | |
| import './index.css'; | |
| import App from './App'; | |
| import registerServiceWorker from './registerServiceWorker'; | |
| import { BrowserRouter } from 'react-router-dom'; | |
| ReactDOM.render(<BrowserRouter><App /></BrowserRouter>, document.getElementById('root')); | |
| registerServiceWorker(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Make it URL link