riot-redux

WebJar for riot-redux

License

License

MIT
Categories

Categories

Github Development Tools Version Controls
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

github-com-danny-andrews-riot-redux
Last Version

Last Version

0.3.3
Release Date

Release Date

Type

Type

jar
Description

Description

riot-redux
WebJar for riot-redux
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/danny-andrews/riot-redux

Download github-com-danny-andrews-riot-redux

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/github-com-danny-andrews-riot-redux/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>github-com-danny-andrews-riot-redux</artifactId>
    <version>0.3.3</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/github-com-danny-andrews-riot-redux/
implementation 'org.webjars.npm:github-com-danny-andrews-riot-redux:0.3.3'
// https://jarcasting.com/artifacts/org.webjars.npm/github-com-danny-andrews-riot-redux/
implementation ("org.webjars.npm:github-com-danny-andrews-riot-redux:0.3.3")
'org.webjars.npm:github-com-danny-andrews-riot-redux:jar:0.3.3'
<dependency org="org.webjars.npm" name="github-com-danny-andrews-riot-redux" rev="0.3.3">
  <artifact name="github-com-danny-andrews-riot-redux" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='github-com-danny-andrews-riot-redux', version='0.3.3')
)
libraryDependencies += "org.webjars.npm" % "github-com-danny-andrews-riot-redux" % "0.3.3"
[org.webjars.npm/github-com-danny-andrews-riot-redux "0.3.3"]

Dependencies

compile (1)

Group / Artifact Type Version
org.webjars.npm : redux jar [1.0.0,)

Project Modules

There are no modules declared in this project.

Riot Redux

Riot bindings for Redux.

Installation

Riot Redux requires Riot 2.1.0 or later.

npm install --save-dev riot-redux

Usage

This mixin will use the following properties set on the component (if they exist):

  • {Object} [actions] An object whose keys are the names of the functions that will be set on the component instance and whose values are action creators. (Note: these will be automatically bound to the dispatch method provided by the redux store inside of the riot-redux mixin's init method.)
  • {Function} [selector] A function which takes state as a parameter and returns an object whose keys are the names of the properties that will be set on the component instance, and whose values are the values of those properties.
  • {Object} store The Redux store passed to the mixin factory function. (Use this only if necessary).

Example:

index.js

import configureStore from './store/configure-store';
import riotRedux from 'riot-redux';

const store = configureStore({age: 12});
riot.mixin('redux', riotRedux(store))

app.tag

<app>
  <tiger actions={actions} selector={selector}>
  <script>
  this.on('mount', function() {
    this.actions = {roar: () => console.log('BWAAA!')};
    this.selector = (state) => ({age: state.age});
  })
  </script>
</app>

tiger.tag

<tiger>
  <p>{age}</p> <!-- 12 -->
  <button onclick={roar}></button> <!-- Clicking me prints 'BWAAA!' in the console. -->
  <script>
    this.mixin('redux');
  </script>
</tiger>

Versions

Version
0.3.3