fkhadra / react-toastify

React notification made easy 🚀 !
https://fkhadra.github.io/react-toastify/introduction
MIT License
12.33k stars 676 forks source link

How do I exclude messages that I don't want to appear in the notification center? #988

Closed maorz555 closed 8 months ago

maorz555 commented 11 months ago

How do I exclude messages that I don't want to appear in the notification center?

BhumikP commented 10 months ago

Hi @maorz555 Can you explain your issue briefly so I can help you? Please also share a codesandbox link with the given issue if possible.

fkhadra commented 8 months ago

Hey @maorz555, you could pass some custom property using the data prop and use that to filter out the one that you don't want to display.

toast("hello", {
  data: {
    exclude: true
  }
})

function App(){
  const { notifications } = useNotificationCenter({
    filter: (item) => item.data.exclude === false
  })
}