Course lesson

Create a Custom useListener Hook Around useCallback

We can capture the pattern we created with useCallback into our own useListener hook. This is essentially copying and pasting the code we wrote, but being very aware of the "dependencies" that useCallback requires so that it doesn't destroy our listener each...

Duration
2 min
Access
Pro
Transcript
Available

We can capture the pattern we created with useCallback into our own useListener hook. This is essentially copying and pasting the code we wrote, but being very aware of the "dependencies" that useCallback requires so that it doesn't destroy our listener each time React renders.