Just trying to work out how to pass this
through the correct way to allow access of redux dispatch events.
loadFile() {
dialog.showOpenDialog({properties: ['openFile']}, function(fileNames) {
// fileNames is an array that contains all the selected
if(fileNames === undefined){
alert("No file selected");
return;
}
fs.readFile(fileNames[0], 'utf-8', (err, data) => {
if (err) {
alert("An error occurred reading the file: " + err.message);
return;
}
this.props.loadData(JSON.parse(data));
});
});
}
via Steven Laidlaw
No comments:
Post a Comment