1.3.0 • Published 2 years 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
2 years ago
1.2.9
2 years ago
1.2.8
2 years ago
1.2.7
2 years ago
1.2.6
2 years ago
1.2.5
2 years ago
1.2.4
2 years ago
1.2.3
2 years ago
1.2.2
2 years ago
1.2.1
2 years ago
1.2.0
2 years ago
1.1.9
2 years ago
1.1.8
2 years ago
1.1.7
2 years ago
1.1.6
2 years ago
1.1.5
2 years ago
1.1.3
2 years ago
1.1.2
2 years ago
1.1.1
2 years ago
1.1.0
2 years ago
1.0.9
2 years ago
1.0.8
2 years ago
1.0.7
2 years ago
1.0.6
2 years ago
1.0.5
2 years ago
1.0.4
2 years ago
1.0.3
2 years ago
1.0.2
2 years ago
1.0.1
2 years ago
1.0.0
2 years ago