import React from "https://esm.sh/react@17.0.2" ; import ReactDOM from "https://esm.sh/react-dom@17.0.2" ; import { BrowserRouter as Router , Link , Route , Switch , } from "https://esm.sh/react-router-dom@5.2.0" ; function App ( ) { return ( < Router > < div > < nav > < ul > < li > < Link to = "/" > Home < /Link> < /li> < li > < Link to = "/about" > About < /Link> < /li> < li > < Link to = "/users" > Users < /Link> < /li> < /ul> < /nav> { } < Switch > < Route path = "/about" > < About /> < /Route> < Route path = "/users" > < Users /> < /Route> < Route path = "/" > < Home /> < /Route> < /Switch> < /div> < /Router>); } function Home ( ) { return < h2 > Home < /h2>; } function About ( ) { return < h2 > About < /h2>; } function Users ( ) { return < h2 > Users < /h2>; } function main ( ) { ReactDOM . render ( React . createElement ( App ) , document . querySelector ( "#main" ) ) ; } addEventListener ( "DOMContentLoaded" , ( ) => { main ( ) ; } ) ;