Cogoport / cogo-toast

Beautiful, Zero Configuration, Toast Messages for React. Only ~ 4kb gzip, with styles and icons
https://cogoport.github.io/cogo-toast
MIT License
673 stars 1 forks source link

Hide is not a function #48

Closed ergunp closed 4 years ago

ergunp commented 4 years ago

Hi,

got the following code

cogoToast.success('This is a success message', {
        onClick: (hide) => {
          hide();
        },
        position: 'top-right',
      });

getting the following error TypeError: hide is not a function I'm on "react": "^16.9.0", "cogo-toast": "^4.2.1"

anmdotdev commented 4 years ago

This API was changed in the new version, in favour of #28

Try this instead...

const { hide } = cogoToast.success('This is a success message.', {
  onClick: () => {
    hide();
  },
});