react-router-dom
import React, { Component } from 'react';import { BrowserRouter as Router, Route, Link } from "react-router-dom";
const Index = () => <h2>Home</h2>;
const About = () => <h2>About</h2>;
const Users = () => <h2>Users</h2>;
const AppRouter = () => (
<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>
<Route path="/" exact component={Index} />
<Route path="/about/" component={About} />
<Route path="/users/" component={Users} />
</div>
</Router>
);
export default AppRouter;
以上是 react-router-dom 的全部内容, 来源链接: utcz.com/z/384370.html