Skip to content
Advertisement

In react How to split the handle change value in react

I need to get the array of handle change value and pass into the API URL. I’ll share my code.

JavaScript

When I select the First dropdown value it passes into the Year and Category Id also. I need to select the first dropdown value pass into the year and the second value is set into the CategoryId. Please share your Idea.

Thanks in Advance.

Advertisement

Answer

this.setState is asynchronous

When your use state in API Url first time, your state is empty yet. When you do it second time state have data from first this.setState call. Your must do API call in seState callback:

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement