Route Module
import {Route} from "react-router-dom"; import Menu from '../header/menu.js'; import Header from '../header/header.js'; import Footer from '../footer/footer.js' import Channel from '../channel/channel.js'; import Login from '../login/login.js'; const indexRouter = [ <Route exact path="/"> <Header /> <Menu /> <Channel /> <Footer /> </Route>, <Route exact path="/news"> <Header /> <Menu /> <h1>News</h1> <Footer /> </Route>, <Route exact path="/contact"> <Header /> <Menu /> <h1>Contact</h1> <Footer /> </Route>, <Route exact path="/about"> <Header /> <Menu /> <h1>About</h1> <Footer /> </Route>, <Route exact path="/login"> <Header /> <Menu /> <Login /> <Footer /> </Route> ]; export default indexRouter;
import React, { Component } from 'react'; import {Switch} from "react-router-dom"; import './App.css'; import indexRouter from './routes/indexRouter'; class App extends Component { render() { return ( <div className="App"> <Switch> {indexRouter} </Switch> </div> ); } } export default App;
import React from 'react'; import ReactDOM from 'react-dom'; import { BrowserRouter } from 'react-router-dom'; import './index.css'; import App from './App'; import reportWebVitals from './reportWebVitals'; ReactDOM.render(, document.getElementById('root') ); // If you want to start measuring performance in your app, pass a function // to log results (for example: reportWebVitals(console.log)) // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals reportWebVitals();
GitHub: "https://github.com/Sokhavuth/emultimedia
Heroku: https://khmerweb-emultimedia.herokuapp.com/
Comments
Post a Comment