Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/rescriptbr/rescript-toastify

ReasonML bindings for react-toastify
https://github.com/rescriptbr/rescript-toastify

Last synced: 3 months ago
JSON representation

ReasonML bindings for react-toastify

Awesome Lists containing this project

README

        







Installation
Examples
Documentation





## Installation
First run the below commands to install the dependencies:
```bash
yarn add @reasonbr/bs-toastify -D
yarn add react-toastify
```
Import react-toastify's css somewhere in your code. You can use `[%bs.raw]` if you want to.
```js
import "react-toastify/dist/ReactToastify.css";
```

## Examples
```reason
open ReactToastify;

[@react.component]
let make = () => {
let handleClick = () => {
let cb = {
Js.log("Cool");
();
};
toast->success(
"Success",
ReactToastify.options(
~autoClose=3000,
~hideProgressBar=false,
~closeOnClick=false,
~onClose=cb,
(),
),
);

toast->warning(
"Warning",
ReactToastify.options(
~autoClose=3000,
~position=`topRight,
~hideProgressBar=false,
~closeOnClick=false,
(),
),
);
();
};

<>

{"Hello" |> ReasonReact.string}


handleClick()}>
{"Click" |> ReasonReact.string}

>;
};

let default = make;
```