My problem is, that I need to update the state of an object inside a loop, but I am in a function component and dont know how to do it.