2.3.2 • Published 2 years ago

mococa-toastr v2.3.2

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

mococa-toastr

image

Installation

npm install mococa-toastr

Usage

To use it, you need to wrap your application with ToastrProvider. You can also pass as parameter to this provider the default timeout for the toastrs to disappear

//index.js
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';

import { ToastrProvider } from 'mococa-toastr';

ReactDOM.render(
  <React.StrictMode>
    <ToastrProvider>
      <App />
    </ToastrProvider>
  </React.StrictMode>,
  document.getElementById('root')
);

Then, to use it in your component:

import { useToastr } from 'mococa-toastr';

function App() {
  const toastr = useToastr();
  const optionals = { timeout: 1234 }


  const openToastr = () => {
    toastr.success('Success', 'success message here', optionals);
  };

  return (
    <div className="App">
      <button onClick={openToastr}>Click me</button>
    </div>
  );
}

Simple as that

2.3.2

2 years ago

2.3.1

2 years ago

2.2.6

2 years ago

2.2.5

2 years ago

2.2.4

2 years ago

2.2.0

2 years ago

2.1.1

2 years ago

2.1.0

2 years ago

2.0.0

2 years ago

1.0.0

2 years ago

0.1.0

2 years ago