Congrats on your first custom app. That is a great accomplishment!
Try the useViewport hook. It updates when the viewport is resized.
By the way, I moved your post to the “Custom Apps” section of the forum so that other users who are interested in custom app development will be able to find your topic more easily.