2.0.1 • Published 3 years ago

redux-popup v2.0.1

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

redux-popup

Redux wrapper for modals

Uses Dialog from react-toolbox

Usage

As component

import {ReduxPopup} from 'redux-popup';

class Popup extends Component {
    
    render() {
        return (
            <div>
                <h1>My popup</h1>
            </div>
        )
    }
    
}

class OtherComponentOrContainer extends Component {
    render() {
            return (
                <ReduxPopup name="test" component={Popup} popupType="storeKey"/>
            )
        }
}

As function

import {createReduxPopup} from 'redux-popup';

class Popup extends Component {
    
    render() {
        return (
            <div>
                <h1>My popup</h1>
            </div>
        )
    }
    
}

export default createReduxPopup({
    name: 'test',
    modal: Dialog,
    popupType: 'storeKey',
})(Popup);

Configuring everything

popupType property defines store (reducer) key default value is 'popup'

    <ReduxPopup name="test" component={Popup} popupType="storeKey"/>

to attach reducer use makePopupReducer

    import {combineReducers} from 'redux';
    import {makePopupReducer} from 'redux-popup';

    export default combineReducers({
        storeKey: makePopupReducer('storeKey'),
    });

to dispatch actions use actionDecorator

    import {closeAllPopups, actionDecorator} from 'redux-popup';

    store.dispatch(actionDecorator('storeKey')(closeAllPopups());
2.0.1

3 years ago

2.0.0

3 years ago

1.1.4

5 years ago

1.1.3

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago

0.2.0

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

0.1.0

7 years ago

0.0.1-alpha.0

7 years ago