title: How to Export Axios Response on Module Export ReactJs
body: <p>I need to export result of axios response on module.exports.
  This is my codes:</p>
  <p><strong>brand.js</strong></p>
  <pre class="lang-js prettyprint-override"><code>var axios = require('axios');
  
  module.exports = (async function() {
      try {
          const { data } = axios.get('http://localhost:8000/api/v1/setting/index');
          console.log(data.data.initial);
          return {
              name: data.data.name,
              desc: data.data.description,
            };      
      } catch (err) {
          console.log(err);
        }      
  })();
  
  </code></pre>
  <p>I try to import the result to be used on another file.
  This is my code.</p>
  <pre class="lang-js prettyprint-override"><code>
  import React from 'react';
  const {brand} = await require(&quot;brand.js&quot;);
    
  class Dashboard extends Component {   
      render(){
          const name = brand.name
          const desc = brand.description;
          return (
          &lt;h1&gt;{title} | {description}&lt;/h1&gt;
          );        
      }
  }  
  </code></pre>
  <p>The result of my code is:</p>
  <pre><code>Can not use keyword 'await' outside an async function
  </code></pre>
  <p>This is error shown on browser:</p>
  <p><a href="https://i.stack.imgur.com/zpiuf.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zpiuf.png" alt="enter image description here" /></a></p>
  <p>How to solved this?</p>