title: React app freezes when dispatching an action through redux-saga
body: <p>I'm trying to get my grasp on react and redux-saga, and the issue I've faced is that whenever I try to dispatch any state-changing action in a functional component's useEffect hook, for instance, using useDispatch hook, the app freezes. Now the useSelector works just fine, I can get the state.</p>
  <p>I've tried reading redux-saga docs' troubleshooting part on app freezing, where it says you have to yield actions, but I have done so:</p>
  <pre><code>import { put } from 'redux-saga/effects';
  
  import * as actions from '../actions/index';
  
  export function* globalLoadingSaga(action) {
    yield put(actions.setGlobalLoading());
  }
  </code></pre>
  <p>I've also tried dropping parentheses, i.e. leaving:</p>
  <pre><code>export function* globalLoadingSaga(action) {
    yield put(actions.setGlobalLoading);
  }
  </code></pre>
  <p>It seems to work then, but I get an error: &quot;Error: Actions must be plain objects. Use custom middleware for async actions.&quot; And, well, the actions are plain objects:</p>
  <pre><code>export const setGlobalLoading = (loading) =&gt; {
    return {
      type: actionTypes.SET_GLOBAL_LOADING,
      loading: loading,
    };
  };
  </code></pre>
  <p>So this does not seem right to me.</p>
  <p>I've also tried to use &quot;fork&quot; instead of &quot;put&quot;, but then it gives me yet another error &quot;Error: fork: argument of type {context, fn} has undefined or null <code>fn</code>&quot;, and, again, this just doesn't feel right to me.</p>
  <p>I've tried googling it, but couldn't find anything that somewhat resembles this issue, and I am lost at this point.</p>
  <p>And the strangest thing is that I know, for sure, that such implementation has worked before, flawlessly. I've got it from a project that I created following an online course some few months ago. Back then everything was fine with it. I did try, out of curiosity, to open that project as well to see if it had the same problem, and, well somehow the app froze too. I had not changed anything, didn't even touch it since then, no dependencies were updated, nothing, but the app hanged still as well.</p>
  <p>Here is a codesandbox snippet stripped to bare minimum, which also freezes possibly due to some sort of loop: <a href="https://codesandbox.io/s/jovial-kowalevski-dotvp?file=/src/index.js" rel="nofollow noreferrer">https://codesandbox.io/s/jovial-kowalevski-dotvp?file=/src/index.js</a></p>