Skip to content

Instantly share code, notes, and snippets.

@nojaja
Created June 13, 2017 10:31
Show Gist options
  • Save nojaja/f59c05ee5200bd873247d5a302d07bed to your computer and use it in GitHub Desktop.
Save nojaja/f59c05ee5200bd873247d5a302d07bed to your computer and use it in GitHub Desktop.
react-router v4
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title></title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/uikit/2.12.0/css/uikit.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://code.jquery.com/jquery-migrate-3.0.0.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-router-dom/4.1.1/react-router-dom.min.js"></script>
<script >
const {BrowserRouter,HashRouter, Switch, Route, Link} = ReactRouterDOM
</script>
</head>
<body>
<BrowserRouter>
<div>
<div className="nav">
<Link to="/home">home</Link>
<Link to="/about">about</Link>
</div>
<Route path="/home" component={PageHome} />
<Route path="/about" component={PageAbout} />
</div>
</BrowserRouter>
<element name="Page-Home">
<template>
<div>home</div>
</template>
</element>
<element name="Page-About">
<template>
<div>About</div>
</template>
</element>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment