Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/arjenhill/beerouter
BeeRouter is a small and exquisite React Router for mobile web project .
https://github.com/arjenhill/beerouter
bee-router react-router
Last synced: about 1 month ago
JSON representation
BeeRouter is a small and exquisite React Router for mobile web project .
- Host: GitHub
- URL: https://github.com/arjenhill/beerouter
- Owner: arjenhill
- License: mit
- Created: 2020-01-13T13:58:40.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-10-12T06:43:00.000Z (about 4 years ago)
- Last Synced: 2024-11-08T02:17:09.497Z (about 1 month ago)
- Topics: bee-router, react-router
- Language: JavaScript
- Homepage:
- Size: 723 KB
- Stars: 7
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-github-star - beerouter
README
## Overview
English | [简体中文](./README_ZH.md)
🦋 Bee router is a small and exquisite React Router for mobile web project, with only 200 lines of code. Different with react-router,bee router has the following advantages:
- Over ten times smaller volume, which makes it is suitable for mobile web projects with limit of code lines.
- Bee router has the same basic functions with react router, such as route switching and routing events etc. , but reducing rarely-used functions in react router.
- Unlike react router which repeatedly initializes components, bee-router only needs to be initialized once, which greatly saves resources.## Usage
[Example](https://ilgei.github.io/beerouter/)
![img](./example.gif)
## Installation
First step:
[![bee-router](https://nodei.co/npm/beerouter.png)](https://npmjs.org/package/beerouter)
```js
npm install beerouter --save
```The second step:
```js
import React from "react";
import Comp1 from "./comp/Comp1.jsx";
import Comp2 from "./comp/Comp2.jsx";
import { BeeRouter, BeeRouterEmitter } from "bee-router";function clickHandler(item) {
BeeRouter.push("/comp" + item);
}function App() {
BeeRouterEmitter.on("router-change", path => {
console.log(path);
});return (
导航1
导航2
);
}export default App;
```## License
MIT