create-react-library
npm install --save rjs-simple-modal
import React from 'react'
import { Modal,useModal } from 'rjs-simple-modal'
import 'rjs-simple-modal/dist/index.css'
function App() {
const { showModal, Toggle } = useModal();
return (
<div className="App">
<div className="demo">
<h1>REACT SIMPLE MODAL</h1>
<button type="button" onClick={()=>{Toggle()}}>
Simple Modal
</button>
</div>
<Modal show={showModal} close={Toggle} title="My Modal">je suis une modal</Modal>
</div>
);
}
export default App;
Add modal in the index.html
<div id="modal"></div>
<div id="root"></div>
Props | Type | Required | Default | Description |
---|---|---|---|---|
showModal | Bool | Required | False | State allows you to display the modal |
Close | Function | Required | - | Function allows you to remove the modal |
title | String | Required | - | Add title modal |
children | String | Required | - | Add content modal |
MIT © Mkiera972