Answers for "react router code"

17

react js router

npm install react-router-dom
Posted by: Guest on November-18-2019
1

react router

import React from 'react';  
    import ReactDOM from 'react-dom';  
    import { Route, Link, BrowserRouter as Router } from 'react-router-dom'  
    import './index.css';  
    import App from './App';  
    import About from './about'  
    import Contact from './contact'  
      
    const routing = (  
      <Router>  
        <div>  
          <h1>React Router Example</h1>  
          <Route exact path="/" component={App} />  
          <Route path="/about" component={About} />  
          <Route path="/contact" component={Contact} />  
        </div>  
      </Router>  
    )  
    ReactDOM.render(routing, document.getElementById('root'));
Posted by: Guest on October-20-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language