React: State updating problem between 2 functions using a mutual state
I have a React component with two functions: one that fetches data (getData) and one that sends the data (sendData). When a button is clicked, I want the following to happen: if getData has not been called before, getData should be called first, then sendData. If getData has been called before, sendData should be called directly.