0.1.5 • Published 2 years ago
@babamibe/modal-component-library v0.1.5
React modal component
A simple modal component that you can open and close on click.
How to download
use npm
Run:
npm install @babamibe/modal-component-library
How to use
Example of use:
import React from 'react';
import Modal from 'modal-component-library';
const Component = () => {
const [isVisible, setIsVisible] = React.useState(false)
return (
<>
<button onClick={() => setIsVisible(true)}>Open Modal</button>
<Modal
isVisible={isVisible}
setIsVisible={setIsVisible}
>
<p>Enter modal children here</p>
</Modal>
</>
)
};
export default Component;
Both props:
isVisible
andsetIsVisible
are required in order to know the current state and to update it.