React-toastify: Console warning: Unknown prop `closeToast` on <div> tag. Remove this prop from the element.

Created on 8 May 2017  路  3Comments  路  Source: fkhadra/react-toastify

Hey,

Getting this warning when using toast:

Warning: Unknown propcloseToaston <div> tag. Remove this prop from the element. For details, see https://fb.me/react-unknown-prop

This is my usage (styling and content text simplified):

import { toast } from 'react-toastify';

export const successToast = () =>  toast(
    <div>
        <span>Completed successfully</span>
    </div>,
    {
        autoClose: 5000,
        type: 'success'
    }
);

Edit:
Made a small workaround to avoid this warning (still should be fixed though):

const Container = (props) => <div>{props.children}</div>;

export const successToast = () =>  toast(
    <Container>
        <div>
            <span>Completed successfully</span>
        </div>
    </Container>,
    {
        autoClose: 5000,
        type: 'success'
    }
);
feature

Most helpful comment

Hello @nirsky,

What's going on with your first snippet is that you try to assign a prop to an html node instead of a react component.
But you're right i'll create a dumb container in case i don't receive a react element.
I'll fix it tonight.

Thank for the input !

All 3 comments

Hello @nirsky,

What's going on with your first snippet is that you try to assign a prop to an html node instead of a react component.
But you're right i'll create a dumb container in case i don't receive a react element.
I'll fix it tonight.

Thank for the input !

@fkhadra Thanks, keep up the good job! Great package, really easy to use.

Hey @nirsky v1.4.2 is live with the fix.

Thanks

Was this page helpful?
0 / 5 - 0 ratings

Related issues

JaLe29 picture JaLe29  路  5Comments

giocodes picture giocodes  路  3Comments

JakubKoralewski picture JakubKoralewski  路  4Comments

joetidee picture joetidee  路  3Comments

prmichaelsen picture prmichaelsen  路  5Comments