Open sonnyboy27 opened 3 years ago
Hi @sonnyboy27, did you try to use HOCs as in the example below?
import React from 'react'
import { withAlert } from 'react-alert'
const App = ({ alert }) => (
<button
onClick={() => {
alert.show('Oh look, an alert!')
}}
>
Show Alert
</button>
)
export default withAlert()(App)
I'm trying to update an old application that I inherited that was using 2.4. Much of the code is triggering the alerts through a callback function after a fetch. These data calls are completely divorced from the page/render context so I'm not sure how to get the reference with the new hooks setup.