Packages

redux

5.0.1 · 23 Dec 2023MIT62.6M / weekRepositoryHomepagenpmAtom feed

Your version

0.3.0

3 Jun 2015Where it was published

0.12.0 is the newest release of 0.3.x.

In short

3 changed

Release note

Complete rewrite.

  • No more strings, now using module bindings for injecting stores and actions

  • Only use decorator for top-level component, keep dumb components pure and testable (#5)

  • Remove transaction logic (will be re-implemented on top of #6)

// The smart component may inject actions
// and observe stores using <Container />:

import React, { Component } from 'react';
import { Root, Container } from 'redux';
import { increment, decrement } from './actions/CounterActions';
import counterStore from './stores/counterStore';
import Counter from './Counter';

export default class CounterContainer {
  render() {
    // stores can be a single store or an array.
    // actions can only be a string -> function map.
    // props passed to children will combine these actions and state.
    return (
      <Container stores={counterStore}
                 actions={{ increment, decrement }}>
        {props => <Counter {...props} />}
      </Container>
    );
  }
}

Minor caveat: Store function names are now significant.