title: Material-UI: how to download a file when clicking a button
body: <p>I know how to download a file when clicking a button using html</p>
  <pre><code>&lt;a href=&quot;./abcf32x.pdf&quot; download=&quot;How-to-download-file.pdf&quot;&gt;
      &lt;button&gt;Download File&lt;/button&gt;
  &lt;/a&gt;
  </code></pre>
  <p>But using Material-UI component how can I do this</p>
  <p>I have the following component</p>
  <pre><code>&lt;div&gt;
    &lt;Button
      variant=&quot;contained&quot;
      color=&quot;#ffa726&quot;
      size=&quot;large&quot;
      startIcon={&lt;GetAppIcon /&gt;}
    &gt;
      Download Sample Method File
    &lt;/Button&gt;
  &lt;/div&gt;
  </code></pre>
  <p><a href="https://i.stack.imgur.com/QapoV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QapoV.png" alt="enter image description here" /></a></p>
  <p>Now I want to download a file whose url is <code>http://localhost:8000/static/sample_method.py</code></p>
  <p>I don't want to open the link in browser and then do save as, rather it should get downloaded directly.</p>