Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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'));  
Source by reacttraining.com #
 
PREVIOUS NEXT
Tagged: #react #router
ADD COMMENT
Topic
Name
7+6 =