Skip to content

Instantly share code, notes, and snippets.

@rudyhuynh
Created September 3, 2019 03:13
Show Gist options
  • Save rudyhuynh/f8eafe5788ef5822f8bb5fc78ed450b3 to your computer and use it in GitHub Desktop.
Save rudyhuynh/f8eafe5788ef5822f8bb5fc78ed450b3 to your computer and use it in GitHub Desktop.
read file with FileReader
const uploadFile = e => {
const file = e.target.files[0];
const fr = new FileReader();
fr.onload = () => {
initialState.queryBuilderState = JSON.parse(fr.result);
forceReRender();
};
fr.readAsText(file);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment