Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

react confirm alert

npm install react-confirm-alert --save //installation

import { confirmAlert } from 'react-confirm-alert'; // Import
import 'react-confirm-alert/src/react-confirm-alert.css'; // Import css

const App = () {
  submit = () => {
    confirmAlert({
      title: 'Confirm to submit',
      message: 'Are you sure to do this.',
      buttons: [
        {
          label: 'Yes',
          onClick: () => alert('Click Yes')
        },
        {
          label: 'No',
          onClick: () => alert('Click No')
        }
      ]
    });
  };

  render() {
    return (
      <div className='container'>
        <button onClick={submit}>Confirm dialog</button>
      </div>
    );
  }
}

export default App;
Comment

PREVIOUS NEXT
Code Example
Javascript :: check if a class exists javascript 
Javascript :: sort array of objects javascript by value 
Javascript :: pangram javascript 
Javascript :: javascript redirect page 
Javascript :: redirect javascript code 
Javascript :: js navigate to another page 
Javascript :: redirect the page in javascript 
Javascript :: convert moment date to utc format moment 
Javascript :: js get distinct values from array 
Javascript :: jquery modal close 
Javascript :: array sort by key javascript 
Javascript :: how to start react project 
Javascript :: remove border on modal material ui 
Javascript :: javascript object array merge 
Javascript :: inner content 
Javascript :: javascript copy an array 
Javascript :: remove null and undefined from array 
Javascript :: onclick event in angular 
Javascript :: javascript check if set 
Javascript :: angular json pipe pretty 
Javascript :: checkbox on click jquery 
Javascript :: check element exist in jquery 
Javascript :: replace object in array javascript 
Javascript :: linking javascript to Flask html 
Javascript :: iframe player youtube onfinish event 
Javascript :: focus js 
Javascript :: regex any letter 
Javascript :: vue js default prop 
Javascript :: number pyramid in javascript 
Javascript :: how to get values from select multiple in js 
ADD CONTENT
Topic
Content
Source link
Name
4+4 =