0.1.21 • Published 7 years ago

redux-instance v0.1.21

Weekly downloads
4
License
ISC
Repository
github
Last release
7 years ago

redux-instance

Provide redux management for multiple instances of the same React component. This package allows developers to code React components with their own state, unconcerned with others in the redux store by applying redux-instance high-order components and functions withInstance, instanceState, instanceReducer, and instanceAction appropriately in react-redux 'connect'.

To install the package redux-instance

npm install --save redux-instance

The top-level component of an example is as followed:

import React from 'react';
import {Provider} from 'react-redux';
import {instanceReducer} from 'redux-instance';
import createStore from './store';
import Dummy from './Dummy';
import {reducer, reducer2} from './reducers';

let store = createStore();

class App extends React.Component {
    render() {
        return (
            <Provider store={store}>
                <div>
                    <Dummy />
                    <Dummy __reducer={instanceReducer(reducer)} />
                    <Dummy __reducer={instanceReducer(reducer2)} />
                </div>
            </Provider>
        );
    }
}

export default App;

To run the example:

git clone https://github.com/levu48/redux-instance
cd redux-instance/examples/next-redux-instance
npm install
npm run dev

then go to http://localhost:3000/dummy to see redux-instance in action.

Credit: This project makes use and modifies Jake Daniel's redux-dynamix

0.1.21

7 years ago

0.1.20

7 years ago

0.1.19

7 years ago

0.1.18

7 years ago

0.1.17

7 years ago

0.1.16

7 years ago

0.1.15

7 years ago

0.1.14

7 years ago

0.1.13

7 years ago

0.1.12

7 years ago

0.1.11

7 years ago

0.1.10

7 years ago

0.1.9

7 years ago

0.1.8

7 years ago

0.1.7

7 years ago

0.1.6

7 years ago

0.1.5

7 years ago

0.1.4

7 years ago

0.1.3

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

1.0.0

7 years ago