@reframe/react-router
v0.3.2
Published
Use React Router's components.
Downloads
23
Readme
Reframe + React Router v4 = :heart:
@reframe/react-router
Use React Router's components.
Usage
Add @reframe/react-router
to your reframe.config.js
:
module.exports = {
$plugins: [
require('@reframe/react-kit'),
require('@reframe/react-router') // npm install @reframe/react-router
]
};
Example
// /plugins/react-router/example/reframe.config.js
module.exports = {
$plugins: [
require('@reframe/react-kit'),
require('@reframe/react-router') // npm install @reframe/react-router
]
};
// /plugins/react-router/example/pages/spa-page.config.js
import React from 'react';
import {Link, Route} from "react-router-dom";
const App = () => (
<div>
<ul>
<li>
<Link to="/">Home</Link>
</li>
<li>
<Link to="/about">About</Link>
</li>
</ul>
<hr />
<Route exact path="/" component={Home} />
<Route path="/about" component={About} />
</div>
);
const Home = () => (
<div>
<h2>Home</h2>
</div>
);
const About = () => (
<div>
<h2>About</h2>
</div>
);
const pageConfig = {
route: '/:params*',
view: App,
};
export default pageConfig;