Closed molvqingtai closed 3 months ago
onMessage
returns a function that, when called, removes the listener.
useEffect(() => {
const removeListener = onMessage('custom-event', () => {
// do some thing...
})
return () => {
removeListener('custom-event'')
}
})
When using onMessage, need to support removing the listener but not all of it, especially when using react StrictMode.