0.1.3 • Published 11 months ago

react-modal-hrnet-mthomas v0.1.3

Weekly downloads
-
License
-
Repository
github
Last release
11 months ago

HRnet

react-modal is a react library allowing to create a modal with a title and content

Install the lib

  1. Go to the npm site via this link https://www.npmjs.com/package/react-modal-hrnet-mthomas
  2. Open the terminal then run the command npm i react-modal-hrnet-mthomas

Use the lib

  1. Call at the top of your component import { Modal } from 'react-modal-hrnet-mthomas';
  2. Call the modal via
  3. The modal takes 3 parameters
  • title: string
  • content: string REQUIRED
  • handleModal: boolean REQUIRED
  1. Here is an example of use:
import { useState } from 'react';
import { Modal } from 'react-modal-hrnet-mthomas';

export function ModalExample() {
    const [modal, setModal] = useState(false);

    return (
        <>
            {modal && (
                <Modal
                    title='Employee created!'
                    content='The employee you created is now available in the "employee list" tab'
                    handleModal={setModal}
                />
            })
            <button onClick={setModal(true)}>Open modal<button/>
        </>
    );
}

/!\Make sure you have Node.js installed on your machine

Team

Developer - Minor Thomas

NPM: https://www.npmjs.com/package/react-modal-hrnet-mthomas