import React from 'react'; class Home extends React.Component { constructor(props) { super(props) this.state = { file: null } this.sendFile = this.sendFile.bind(this) } sendFile(event) { event.preventDefault(); let formData = new FormData(); formData.append('myFile', this.state.file); fetch('/api/uploadFile/excel', { method: 'POST', body: formData }) .then(response => response.json()) .then(data => { console.log(data) }) .catch(error => { console.error(error) }) } render() { return (