@tabikaeru/react-modal-hooks
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

React Modal Hooks

Simple hooks library to help using modal.

Usage

import { useModal } from '@tabikaeru/react-modal-hooks'

const MyModal = ({isVisible, onClose})=>(
    <Modal isVisible={isVisible}>
        <button onClick={onClose}>Close</button>
    </Modal>
)

const Page = ()=>{
    const {isVisible, onOpen, onClose }= useModal()
    return (
        <Fragment>
            <div>
                <button onClick={onOpen}>Open </button>
            </div>
            <MyModal isVisible={isVisible} onClose={onClose}/>
        </Fragment>
    )
}

Readme

Keywords

none

Package Sidebar

Install

npm i @tabikaeru/react-modal-hooks

Weekly Downloads

1

Version

1.0.3

License

MIT

Unpacked Size

2.99 kB

Total Files

6

Last publish

Collaborators

  • tabikaeru