fkhadra / react-toastify

React notification made easy 🚀 !
https://fkhadra.github.io/react-toastify/introduction
MIT License
12.55k stars 691 forks source link

Add support for functions as content #106

Closed giocodes closed 6 years ago

giocodes commented 6 years ago

Hello! First of all, THANK YOU this is a great library. 👏 X1000 I want to suggest adding support for functions as content. Example:

toast(({ closeToast }) =>
  <div>
    <p onClick={handlerX}>Do something</p>
    <p onClick={closeToast}>Close</p>
  </div>
);

I believe this currently returns nothing.

fkhadra commented 6 years ago

Hello @giocodes,

Glad you like it.

When you call the toast function it returns a toastId. That one can be used to dismiss or to update the toast.

Anyway, I will probably allow this pattern in the next release. I'll let you know as soon as it's available.

fkhadra commented 6 years ago

Feature released.

giocodes commented 6 years ago

Awesome! Thanks