In my use case there are some controlled input components that stores data in states. When I change one of the dropdown input, it changes 3 more states and triggers an API call. How can I ensure that the 3 states are updated before making the API call ? I am using react functional component.