You'd use a resize event listener to programatically set whether a page is viewed on a mobile device, for example. You always have to remove the attached event listener in order to prevent leaking, which we do in the useEffect's return. Create a memoized function using useCallback and pass it as the event's handler. You can use any kind of listener this way.
Resize me to see a console log!