Skip to content

Commit e99bc0e

Browse files
ntilwalliTylorS
authored andcommitted
chore(README): Update README for v3, remove switch-path dep (#125)
1 parent d707f2c commit e99bc0e

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

README.md

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,21 @@
11
# cyclic-router
22
cyclic-router is a Router Driver built for Cycle.js
33

4-
**Disclaimer** v2.x.x is for Cycle Diversity!
4+
**Disclaimer** v2.x.x and v3 are for Cycle Diversity!
55
If you are still using @cycle/core please continue to use v1.x.x
66

77
## Installation
88

99
Using [npm](https://www.npmjs.com/):
1010

11-
$ npm install cyclic-router
11+
$ npm install --save cyclic-router
12+
13+
Version 3 requires users to inject the route matcher. We'll use `switch-path` for our examples but other
14+
matching libraries could be adapted to be used here:
15+
16+
$ npm install --save switch-path
17+
18+
Note: Version 2 and below use `switch-path` for the route matcher always and the above library install is not necesssary/done implicitly.
1219

1320
Then with a module bundler like [browserify](http://browserify.org/), use as you would anything else:
1421

@@ -22,7 +29,7 @@ var makeRouterDriver = require('cyclic-router').makeRouterDriver
2229

2330
## API
2431

25-
For API documentation pleave visit this link [here](http://cyclejs-community.github.io/cyclic-router/docs/)
32+
For API documentation please visit this link [here](http://cyclejs-community.github.io/cyclic-router/docs/)
2633

2734
## Basic Usage
2835

@@ -32,6 +39,7 @@ import Cycle from '@cycle/xstream-run';
3239
import {makeDOMDriver} from '@cycle/dom';
3340
import {makeRouterDriver} from 'cyclic-router';
3441
import {createHistory} from 'history';
42+
import switchPath from 'switch-path'; // Required in v3, not required in v2 or below
3543

3644
function main(sources) {
3745
const match$ = sources.router.define({
@@ -53,13 +61,14 @@ function main(sources) {
5361

5462
Cycle.run(main, {
5563
DOM: makeDOMDriver('#app'),
56-
router: makeRouterDriver(createHistory())
64+
router: makeRouterDriver(createHistory(), switchPath) // v3
65+
// router: makeRouterDriver(createHistory()) // <= v2
5766
});
5867
```
5968

6069
### Route Parameters
6170

62-
You can pass route parameters to your component by adding them to the component sources.
71+
This behavior changes based on the injected route matcher. In the case of `switch-path`, you can pass route parameters to your component by adding them to the component sources.
6372

6473
```js
6574
const routes = {

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@
1919
"homepage": "https://github.com/TylorS/cyclic-router#readme",
2020
"dependencies": {
2121
"@cycle/history": "^4.0.0",
22-
"history": "^3.0.0",
23-
"switch-path": "^1.1.7"
22+
"history": "^3.0.0"
2423
},
2524
"devDependencies": {
2625
"@cycle/base": "^4.0.0",
@@ -44,7 +43,8 @@
4443
"typings": "^0.8.1",
4544
"uglify-js": "^2.7.1",
4645
"validate-commit-message": "^3.0.1",
47-
"xstream": "^5.0.6"
46+
"xstream": "^5.0.6",
47+
"switch-path": "^1.1.8"
4848
},
4949
"config": {
5050
"ghooks": {

0 commit comments

Comments
 (0)