redux-fancy

0.2.2 • Public • Published

Redux fancy

Manage your ui state with redux.

Installation

npm install --save redux-fancy

Get started

MyCustomUiComponent.js

const MyCustomComponent = ({setState, isLoading}) =>
    <div onClick = {() => setState({isLoading: false})}>
        { isLoading &&  "I'm loading!" }
        { !isLoading &&  "I've stopped loading... :(" }
    </div>
export default MyCustomComponent;

Each component gets through props setState function that behaves similar to react setState, and all the props that were passed through initial state.

MyCustomComponent.js

import fancy from 'redux-fancy';
import MyCustomComponent from './MyCustomUiComponent';

const Component = fancy({
    name: 'FancyComponent',
    initialState: {
        isLoading: true
    }
})(MyCustomComponent);
export default Component;

In your app render component.

<Provider>
    <Component />
</Provider>

API

Readme

Keywords

Package Sidebar

Install

npm i redux-fancy

Weekly Downloads

3

Version

0.2.2

License

ISC

Last publish

Collaborators

  • djercic