Hi Everyone,

I am trying to do this API call where it’s supposed to get data based on a specific date. The problem is I don’t know where to place the dateFunction() such that it runs before the API call.

Without the dateFunction() the state of fromDate & toDate is empty. Hence the map function prints out all the data in the table which I don’t want.

Post image

Can I put the dateFunction() in componentDidMount() so that it runs before the API call?

Thanks again Redditors! You guys/gals helped me so many times!!!



Source link

Write A Comment