0.1.5 • Published 2 years ago

@babamibe/modal-component-library v0.1.5

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

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 and setIsVisible are required in order to know the current state and to update it.