https://github.com/rt2zz/react-dumb-modal
a simpler modal
https://github.com/rt2zz/react-dumb-modal
Last synced: 12 months ago
JSON representation
a simpler modal
- Host: GitHub
- URL: https://github.com/rt2zz/react-dumb-modal
- Owner: rt2zz
- Created: 2015-03-08T04:54:42.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2017-11-02T19:38:14.000Z (over 8 years ago)
- Last Synced: 2025-06-09T14:19:48.015Z (about 1 year ago)
- Language: JavaScript
- Size: 4.88 KB
- Stars: 6
- Watchers: 2
- Forks: 7
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# React Dumb Modal
A simpler modal. A modal that is not self-aware.
```js
var Modal = require('react-dumb-modal')
```
Dumb Modals are always visible, hence being "dumb". Consequently you will need to control the visibility of the modal from the parent component. By moving all of the state out of the child component, it becomes easier to reason with. The same goes for any modal animations.
**note:** the dismiss prop is a function that will be called when a user presses escape or clicks off of the modal. Assuming you want to allow the user to dismiss the modal, you should implement some logic here that toggle off the modal (either by removing it altogether or changing the style).
## Usage
See props in the usage example below:
```js
```
## Practical Example
```js
import React, { Component } from 'react'
import Modal from 'react-dumb-modal'
class Page extends Component {
toggleModal = () => {
this.setState({showModal: !this.state.showModal})
}
render() {
return(
{this.state.showModal ? : null}
)
})
```