1.0.1 • Published 4 years ago

react-confirmation-dialog v1.0.1

Weekly downloads
1
License
MIT
Repository
-
Last release
4 years ago

react-confirmation-dialog

react-confirmation-dialog version react-confirmation-dialog license

Shows a confirmation dialog (modal) and the user needs to accept or cancel.

Installation

npm i --save react-confirmation-dialog

Example

react-emoji-dialog

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

Erik Martín Jordán

License

This component is open source and available under the MIT License.