title: How do async redux functions work?
body: <p>I started learning redux in reactjs. I am trying to implement an async structure to redux but I am really confused...</p>
  
  <p>To implement an async function and use the promise you should type async before your function and use await before using the promise.</p>
  
  <p>But in many examples I never saw they use of async before functions and await before the promise variables.</p>
  
  <p>For example look at these two links:</p>
  
  <p><a href="https://redux.js.org/advanced/async-actions" rel="nofollow noreferrer">https://redux.js.org/advanced/async-actions</a></p>
  
  <p><a href="https://github.com/reduxjs/redux/tree/master/examples/async" rel="nofollow noreferrer">https://github.com/reduxjs/redux/tree/master/examples/async</a></p>
  
  <p>So how can I call async function in the reducer and return the async results?</p>
  
  <p>For example, I want to prepare this list with an async function and get the list with axios or fetch API :</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>const list = [
      {id: 1, title: 'One'},
      {id: 2, title: 'Two'},
      {id: 3, title: 'Three'}
  ]
  
  export function newsReducer(state = [], action) {
      switch (action.type) {
          case 'GET_NEWS':
              return list
          default:
              return state
      }
  }</code></pre>
  </div>
  </div>
  </p>