1.0.4 • Published 7 years ago

redux-setstate v1.0.4

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

redux-setstate

A setState api for purely functional components.

Example usage

// In reducer.js

import { reducer as localState } from 'redux-setstate';

export default combineReducers({
  localState,
});


// In MyComponent.js
import React from 'react';
import { SetState } from 'redux-setstate';

const configureState = SetState('counter-app', {}, { count: 0 });

export const App = ({ localState, setState }) => (
  <div>
    <h3>Count: {localState.count}</h3>
    <button onClick={() => setState({ count: localState.count + 1 })}>+</button>
    <button onClick={() => localState > 0 && setState({ count: localState.count - 1 })}>+</button>
  <div>
);

export default configureState(App);
1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago