axios.post('http://www.example.com/generatePDF.php',
{...params},
{responseType: 'blob', // VERY IMPORTANT
headers: {'Accept': 'application/pdf'}})
.then((response) => {
const blob = new Blob([response.data])
const url = window.URL.createObjectURL(blob)
this.setState({fileUrl: url, loading: false})
})