The problem was that I needed to use UseEffect to get the updated values, but it's not that obvious in my case.