You can render any valid
ReactNode: string, number, component... This is really straightforward.
When you render a component, a
closeToast prop and the
toastProps are injected into your component.
You can also render a component using a function. More or less like a "render props":
Example with react context 🚀
In this example we will use react context to share state accross a component and a toast. Increment and display a toast at the same time to see how the state stay in sync !
When you want to use a hook inside a toast you must do
toast(YourComponent) would not work because there is no way to know that this is a react element