1.3.0 • Published 9 months ago
react-ts-modal-cserizay v1.3.0
react-ts-modal-cserizay - Modal creation & management in React (compatible with TypeScript)
Table of Contents
Installation
npm install react-ts-modal-cserizay
Prerequisites
Usages
import { useState } from 'react';
import { ModalWindow } from 'react-ts-modal-cserizay';
const RandomReactComponent = () => {
// Create a state to manage the modal's state
const [isOpen, setIsOpen] = useState(false);
// Create a function to open the modal
const handleOpen = () => {
setIsOpen(true);
};
// Create a function to close the modal
const handleClose = () => {
setIsOpen(false);
};
return (
<div>
<button onClick={handleOpen}>Open Modal</button>
<ModalWindow isOpen={isOpen} onClose={handleClose}>
<p>You successfully opened the modal!</p>
</ModalWindow>
</div>
);
};
&& another example
import { useState } from 'react';
import { ModalWindow } from 'react-ts-modal-cserizay';
const AnotherRandomReactComponent = () => {
const [isOpen, setIsOpen] = useState(false);
const handleClose = () => {
setIsOpen(false);
};
return (
<div>
<ModalWindow isOpen={isOpen} onClose={handleClose}>
<p>Are you sure you want to quit?</p>
<button onClick={handleClose}>Yes, close the modal.</button>
</ModalWindow>
</div>
);
};
License
This project was created by Clément Serizay for OpenClassrooms Project 14.
1.3.0
9 months ago
1.2.9
9 months ago
1.2.8
9 months ago
1.2.7
9 months ago
1.2.6
9 months ago
1.2.5
10 months ago
1.2.4
10 months ago
1.2.3
10 months ago
1.2.2
10 months ago
1.2.1
10 months ago
1.2.0
11 months ago
1.1.9
11 months ago
1.1.8
11 months ago
1.1.7
11 months ago
1.1.6
11 months ago
1.1.5
11 months ago
1.1.3
11 months ago
1.1.2
11 months ago
1.1.1
11 months ago
1.1.0
11 months ago
1.0.9
11 months ago
1.0.8
11 months ago
1.0.7
11 months ago
1.0.6
11 months ago
1.0.5
11 months ago
1.0.4
11 months ago
1.0.3
11 months ago
1.0.2
11 months ago
1.0.1
11 months ago
1.0.0
11 months ago