https://github.com/klen/redux-riot
Dynamically generated mixin to add Redux support into your Riot application
https://github.com/klen/redux-riot
Last synced: 11 months ago
JSON representation
Dynamically generated mixin to add Redux support into your Riot application
- Host: GitHub
- URL: https://github.com/klen/redux-riot
- Owner: klen
- License: mit
- Created: 2017-09-18T12:21:39.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-11-02T11:57:07.000Z (over 8 years ago)
- Last Synced: 2024-08-22T20:12:17.523Z (almost 2 years ago)
- Language: CoffeeScript
- Size: 8.79 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# redux-riot
[](https://badge.fury.io/js/redux-riot)
[](https://travis-ci.org/klen/redux-riot)
A Riot integration to Redux
## Installation
```bash
npm install --save redux-riot
```
### Dependencies
`redux-riot` depends on `redux`, `riot`.
## How to use?
### Configure and setup the mixin
```js
import Riot from 'riot'
import RiotReduxMixin from 'redux-riot';
import {createStore} from 'redux';
const store = createStore(
// ...
)
Riot.mixin(RiotReduxMixin(store)) // install globally
Riot.mixin('redux', RiotReduxMixin(store)) // or shared
```
### Use in your tags
```js
// Initialize the mixin
// (skip this if the mixin is installed globally)
this.mixin('redux')
// Subscribe to state changes (reselect is supported)
this.subscribe( (state) => state.some )
this.subscribe( require('./selector'))
this.subscribe( require('./selector'), callback )
// Bind actions to this.actions
this.actions( require('./actions') )
// Use binded actions
this.actions.select('payload')
```
## License
This project is licensed under the MIT license, Copyright (c) 2017 Kirill Klenov. For more information see `LICENSE.md`.
## Acknowledgements
[Dan Abramov](https://github.com/gaearon) for Redux and Riot team for [Riot](https://github.com/riot/riot). A Simple and elegant component-based UI library