1.1.2 • Published 1 year ago

modal-with-message v1.1.2

Weekly downloads
-
License
-
Repository
github
Last release
1 year ago

Modal with custom message

This repository contains all the source code of a modal component with custom message for react.

Installation

Install the lib

npm install modal-with-message
# ou
yarn install modal-with-message

Usage/Examples

import { useState, useEffect } from 'react';
// Import Modal
import ModalMessage from 'modal-with-message';

//  Creates a button, when I click on it the state changes to true and the modal is displayed
function ButtonModal() {

    const [modal, setModal] = useState(false)

    // Function to display modal
    function displayModal(setvar){
        if (modal === true){
        return (
            <ModalMessage message={"Employee Created!"} setVar={setModal}/>
            )
        }
            return(
            ""
            )
    }

    return (
        <div className="App">
            {displayModal(setModal)}
        <button
            type="submit"
            className="openModal"
            onClick={() => {setModal(true);}}
        >
            Save
        </button>
        </div>
    )
}

export default ButtonModal;

Authors

1.1.2

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago