success-custom-modal
TypeScript icon, indicating that this package has built-in type declarations

0.1.9 • Public • Published

My Modal Component

A reusable modal component for React.

Installation

npm install success-custom-modal

Usage

To use the ModalComponent in your React application, follow these steps:

Importing the ModalComponent

First, import the ModalComponent into your React component file:

import React, { useState } from "react";
import { ModalComponent } from "success-custom-modal";

Using the ModalComponent

Now, you can use the ModalComponent in your component's render method. Here's an example of how to use it:

const YourComponent = () => {
  const [showModal, setShowModal] = useState(false);

  const handleShowModal = () => {
    setShowModal(true);
  };

  const handleCloseModal = () => {
    setShowModal(false);
  };

  return (
    <div>
      <button onClick={handleShowModal}>Show Modal</button>
      <ModalComponent show={showModal} handleClose={handleCloseModal} />
    </div>
  );
};

export default YourComponent;

Customize this example to fit your application's needs. The show prop controls whether the modal is displayed, and the handleClose function should be used to close the modal.

License

This project is licensed under the MIT License.

This is for educational purpose so feel free to reuse it and adapt for your personal need

Package Sidebar

Install

npm i success-custom-modal

Weekly Downloads

2

Version

0.1.9

License

MIT

Unpacked Size

25.8 kB

Total Files

13

Last publish

Collaborators

  • joharisoa