Skip to content

v0.3.0

Pre-release
Pre-release
Compare
Choose a tag to compare
@gaearon gaearon released this 03 Jun 00:51
· 4005 commits to master since this release

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.