-
Notifications
You must be signed in to change notification settings - Fork 331
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Warning validateDOMNesting in case toast message contains <div> #5
Comments
Thanks, good catch. Will fix this with the next release. |
Replacement is never a good choice! What if the developer has specific styling to just that I'd rather have the library throw an error (or at least log as error and not render the toaster at all) than modify the input from the dev. Remember, if you silently fix a mistake from a developer you inadvertly are not helping them and thus they are stuck with that knowledge until someone points it out for them. Best choice would be if you provide an option for silently logging errors instead of throwing it in such scenarios, if the user wants to pass it as an argument. |
It will be good to have the ability to override default toast container ( |
@albannurkollari Not sure if I got that correctly, but I think by replacing @ambroseus was referring to using That said I agree that it should be possible to render a custom component, without having to go headless. Not sure yet what's the best API here since there are two components (ToastBar + Message) that need to be replaced. Maybe a |
@timolins maybe something like this (override Message component at all): <Toaster toastOptions={{
MessageContainer: (props) => <div {...props} />
}} /> |
@timolins Thanks for clarification, I wasn't aware that fhe context was for the default wrapper of the Toaster! And ofc, the error/warning comes from React. |
I'll open a new issue regarding the message customisation. |
Got warning in Chrome:
validateDOMNesting(...): <div> cannot appear as a descendant of <p>.
with material-ui's
<Alert>
inside toast message (or any other div)Possible solution: replace
'p'
with'div'
react-hot-toast/src/components/toast-bar.tsx
Line 39 in 9045f1c
The text was updated successfully, but these errors were encountered: