1.1.0 • Published 7 years ago

redux-static v1.1.0

Weekly downloads
18
License
MIT
Repository
github
Last release
7 years ago

Redux Static

Static initialization for Redux. This allows you to define your actions and state in the same static way that you define propTypes and defaultProps.

Example:

import { connectContainer } from 'redux-static';
import React, { Component, PropTypes } from 'react';

import { invoiceActions } from '../actions';

export default connectContainer(class extends Component {
  static stateToProps = (state) => ({
    invoices: state.invoices
  });

  static actionsToProps = {
    ...invoiceActions
  }

  static propTypes = {
    invoices: PropTypes.object,
    fetchInvoices: PropTypes.func.required
  }

  componentWillMount() {
    this.props.fetchInvoices();
  }

  render() {
    return <InvoicesTable invoices={invoices} />;
  }
});

License

MIT