1.3.1 • Published 4 years ago

redux-react-modals v1.3.1

Weekly downloads
57
License
MPL-2.0
Repository
github
Last release
4 years ago

redux-react-modals

EN CONSTRUCTION Ce code est du code externalisé du https://github.com/betagouv/pass-culture-shared qui concentre un nombre d'utilités React Redux utilisé par les applications front du pass culture. Tant que les tests fonctionnels ne sont pas écrits, cette lib ne peut être considérée en production.

Basic Usage

You need to add first the modals reducer in your root reducer:

import { modals } from 'redux-react-modals'
import { combineReducers } from 'redux'

const rootReducer = combineReducers({
  ...
  modals,
})

const store = createStore(rootReducer)

Then the lib provides a Modal component and some redux actions, like:

import React, { Fragment } from 'react'
import { Modal, showModal } from 'redux-react-modals'

class Foo extends Component {

  onShowModalClick = () => {
    const { dispatch } = this.props
    dispatch(showModal('foo', <div> Hello! </div>))
  }

  render () {
    const { query } = this.props
    const { counter } = query.parse()
    return (
      <Fragment>
        <button onClick={this.onShowModalClick} />
          Show Modal
        <button>
        <Modal />
      </Fragment>
    )
  }
}

export default connect()(Foo)
1.3.1

4 years ago

1.3.0

4 years ago

1.2.0

5 years ago

1.1.0

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago

0.0.11

5 years ago

0.0.10

5 years ago

0.0.9

5 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago