React: File download

 React: File download


Got a requirement to save api response data (blob) to a file.


setLoading(true);
const responseData = await callApi();
setLoading(false);
var blob = new Blob([responseData], { type: "application/json" });
let url = window.URL.createObjectURL(blob);

// Creating the hyperlink and auto click it to start the download
let link = document.createElement("a");
link.href = url;
link.download = "samplefile.json";
link.click();

GIT: Edit last commit message

 GIT: Edit last commit message (not pushed)


git commit --amend -m "New commit message"

Reference
https://stackoverflow.com/questions/179123/how-to-modify-existing-unpushed-commit-messages