I have 2 functions, function uploadFile
uploads the file image to firebase and then store the returned url through setState
, and function saveTeam
which send a request to /new-team-member
with payload including the returned url
const saveTeamMain = () => {
uploadFile();
saveTeam();
};
<button onClick={saveTeamMain}>Save</button>
But when i click Save
it doesn’t do anything for the first time, and then triggers the function on the second click, why is that happening ?