react-disclosure-hook
v1.0.4
Published
a simple show/hide disclosure hook
Downloads
2
Readme
react-disclosure
a simple show/hide disclosure hook
Install
npm install --save react-disclosure-hook
or
yarn add react-disclosure-hook
Usage
import React from 'react'
import { useDisclosure } from 'react-disclosure-hook'
const App = () => {
const { isShowing, show, hide } = useDisclosure()
return (
<div
style={{
display: 'flex',
flexDirection: 'column',
justifyContent: 'center',
alignItems: 'center',
width: '100vw',
height: '100vh'
}}
>
{isShowing && <h2> Can you smell what the rock is cooking?</h2>}
<div>
<button onClick={hide}>Hide</button>
<button onClick={show}>Show</button>
</div>
</div>
)
}
export default App
License
MIT © @thesilentdev