LipeMachado

Untitled

Nov 20th, 2022
704
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JavaScript 0.98 KB | Source Code | 0 0
  1. import { React, useRef } from 'react';
  2. import NotificationAlert from 'react-notification-alert';
  3. import {Card, Row, Col, Button} from "reactstrap";
  4.  
  5. var options = {}
  6.  
  7. options = {
  8.       place: 'br',
  9.       message: (
  10.           <div>
  11.               <div>
  12.                   Welcome to <b>Now UI Dashboard React</b> - a beautiful freebie for every web developer.
  13.               </div>
  14.           </div>
  15.       ),
  16.       type: "success",
  17.       icon: "fa fa-user",
  18.       autoDismiss: 7
  19.   }
  20.  
  21. function App() {
  22.     const refOptions = useRef(null)
  23.  
  24.     const myFunc = () => {
  25.         refOptions.current.notificationAlert(options);
  26.     }
  27.  
  28.     return (
  29.       <div className="content">
  30.         <Row>
  31.             <Col md="12">
  32.               <Card className="card text-center">
  33.               <NotificationAlert ref={refOptions} />
  34.                   <Button onClick={myFunc}>Hey</Button>
  35.             </Card>
  36.           </Col>
  37.         </Row>
  38.       </div>
  39.     );
  40. }
  41.  
  42. export default App;
Advertisement
Add Comment
Please, Sign In to add comment