Cool stuff Tom. You could even make a custom hook to wrap up all that logic. I made a simple demo here if you're interested. Sidenote, this is the first time I create a hook. 😉
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.