meiosis-router
v1.1.0
Published
Meiosis Helpers - Router
Downloads
19
Maintainers
Readme
meiosis-router
Meiosis is a pattern, not a library. Nevertheless, in response to popular demand and for your convenience, here is a module that sets up a router for use with Meiosis.
Principles
- Store the route in the application state
- Use the route in the state to determine which page to render, what data to load, etc.
- Clicking on a link, changing the URL in the location bar, etc. changes the route in the state
- Changing the route in the state programmatically synchronizes the URL in the location bar.
Installation
Using npm
:
npm i meiosis-router
Then you can import it and use it with this code:
import { createRouter } from 'meiosis-router';
const router = createRouter({ ... });
Using a script
tag:
<script src="https://unpkg.com/meiosis-router/meiosis-router.js"></script>
Or load the minimized version:
<script src="https://unpkg.com/meiosis-router/meiosis-router.min.js"></script>
Then use the MeiosisRouter
global variable:
const router = MeiosisRouter.createRouter({ ... });
Documentation
Please refer to the meiosis-router
Documentation.
meiosis-router is developed by foxdonut (@foxdonut00) and is released under the MIT license.