sandbox: https://codesandbox.io/s/angry-ganguly-6q0q2?file=/src/MessageToast.tsx
With the above code I'm trying to display react-toastify with state using redux. Once I click the login button from an another component the error state changes to true and gets inside the function errorToast() in messageToast component. But the toast is not getting displayed, need some help in fixing this. Thank you.
Toast is not showing because the message
in the redux store is undefined, so it doesn't show the message.
In the main.ts
, change:
dispatch(showToast())
to:
dispatch(showToast('message', true))
Cause this action creator needs some parameters. (message
and isError
).