https://computerbestrepair.blogspot.com/2023/02/wait-for-state-to-update-using-usestate.html
Wait For State To Update Using UseState Hook And Then Run Code Inside A Funciton