Closed aaronsajo closed 3 years ago
@aaronsajo
NeetoUI uses react-toastify
so if you look at the code
section of the Toastr
. You can see a <ToastContainer />
this is a component that react-toastify
provides.
Ref: https://www.npmjs.com/package/react-toastify
I'm assuming you have already installed react-toastify
, else add this dependency.
yarn add react-toastify
then add import 'react-toastify/dist/ReactToastify.css'
to your index.js
. Also import the <ToastContainer />
in your main component. (For global availability)
Eg:
import React from 'react';
import { ToastContainer, toast } from 'react-toastify';
import 'react-toastify/dist/ReactToastify.css';
function App(){
const notify = () => toast("Wow so easy!");
return (
<div>
<button onClick={notify}>Notify!</button>
<ToastContainer />
</div>
);
}
This should get the toastr working as desired.
@karthiknmenon Not able to use Toastr from "@bigbinary/neetoui/v2". Or may be I am using it in the wrong way.
Here copy is a function that being called on onClick.