I'm making a request to an API that creates a PDF file on my public folder. After getting response react automatically re-renders the page and ignores everything else to do.
I need to redirect to another page with the name of the generated PDF but re-renders the same page.
API.post('some_url', formData) //this creates a pdf file on public folder
.then(res => {
//Ignores redirection
this.props.history('other_page', res.pdf_name)
})
I found that the problem was creating the pdf file by trial and error, and when pasting manually a file in the public folder it automatically re-renders the page where i'm currently.
How can i prevent this behavior?