how-to-open-sweetalert-popup-on-button-click-in-reactjs
npm install sweetalert2-react
//////////////////////////////////////////////////////////
import React from 'react';
import './App.css';
import Swal from 'sweetalert2'
class App extends React.Component {
opensweetalert = () =>
{
Swal.fire({
title: 'Therichpost',
text: "Hello",
type: 'success',
}
render() {
return (
<div className="maincontainer">
<h1>Reactjs</h1>
<button onClick={this.opensweetalert}>Open Success Sweetalert Popup</button>
</div>
)
};
}
export default App;