# react-redux-dialog

> Handle React modal dialogs easily within the context of redux

Latest version **2.0.1** (published 2018-02-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-redux-dialog
pnpm add react-redux-dialog
yarn add react-redux-dialog
bun add react-redux-dialog
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.1 |
| Published | 2018-02-03 |
| First published | 2017-09-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Steven Silvestri |
| Maintainers | ssilve1989 |
| Keywords | react-component, redux, react, modal, dialog |

## Links

- npm: https://www.npmjs.com/package/react-redux-dialog
- Repository: https://github.com/ssilve1989/react-redux-dialog
- Homepage: https://github.com/ssilve1989/react-redux-dialog#readme
- Issues: https://github.com/ssilve1989/react-redux-dialog/issues
- npm.io page: https://npm.io/package/react-redux-dialog

## Dependencies (2)

- [prop-types](https://npm.io/package/prop-types.md) 15.6.0
- [react-modal](https://npm.io/package/react-modal.md) 3.1.11

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 2.0.1 (latest) — 2018-02-03
- 2.0.0 — 2018-02-03
- 1.0.3 — 2017-09-14
- 1.0.2 — 2017-09-14
- 1.0.1 — 2017-09-14
- 1.0.0 — 2017-09-14

## README

# react-redux-dialog

[![Travis](https://img.shields.io/travis/ssilve1989/react-redux-dialog.svg)](https://travis-ci.org/ssilve1989/redux-session-manager-middleware)
[![npm](https://img.shields.io/npm/v/react-redux-dialog.svg?style=flat-square)](https://www.npmjs.com/package/redux-session-manager-middleware)
[![Coveralls](https://img.shields.io/coveralls/ssilve1989/react-redux-dialog.svg?style=flat-square)](https://coveralls.io/github/ssilve1989/react-redux-dialog)

Gracefully handle presenting Modal Dialogs via Redux. Leverages [react-modal](https://github.com/reactjs/react-modal).

# Installation
```bash
npm i -S react redux react-redux react-redux-dialog
```

# Usage

## Mount the reducer
The reducer must be mounted at 'modal'.
```javascript
import { combineReducers } from 'redux';
import { reducer as modal } from 'react-redux-dialog';

export default combineReducers({ 
    modal,
    // ... other reducers
})
```

## Mount the container
```jsx harmony
import { ModalContainer } from 'react-redux-dialog';
class App extends React.Component {
	render() {
		return (
			<div>
			    <ModalContainer />
			    {/* ... the rest of your component */}
            		</div>
		)
	}
}
```

## Dispatch a modal via setModal
```javascript
import { setModal } from 'react-redux-dialog';

setModal(AnyComponent, {
    componentProps: { /* Props your AnyComponent uses */ },
    modalProps: { ... }
})
```

And that's it! The ModalContainer will take care of the rest.

### modalProps
| Property | type | Required? | Description |
|:--|:--|:--|:--
title | string | no | A title for the modal, that will appear in the header |
showClose | [boolean=false] | no | Show a close button for the modal

Additionally any other valid prop that [react-modal](https://github.com/reactjs/react-modal) uses will be passed along to the internal Modal.

---
_Source: https://npm.io/package/react-redux-dialog · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
