How to wait for state to update without useEffect? - Theo's Typesafe Cult