1.0.1 • Published 4 years ago
react-confirmation-dialog v1.0.1
react-confirmation-dialog
Shows a confirmation dialog (modal) and the user needs to accept or cancel.
Installation
npm i --save react-confirmation-dialog
Example
How to use
import React, { useState } from 'react';
import Confirmation from './Confirmation'
function App() {
const [display, setDisplay] = useState(true);
const acceptFunction = () => {
console.log('Accept');
setDisplay(false);
}
const cancelFunction = () => {
console.log('Cancel');
setDisplay(false);
}
return (
<div>
{ display
? <Confirmation
mainMessage = {'Do you want to download your data?'}
acceptFunction = {acceptFunction}
acceptButton = {'Accept'}
cancelFunction = {cancelFunction}
cancelButton = {'Cancel'}
/>
: null
}
</div>
);
}
export default App;
Author
License
This component is open source and available under the MIT License.