title: How to use React Hook in Redux Saga?
body: <hr />
  <p><a href="https://stackoverflow.com/a/70387892/14745811">My solution</a></p>
  <hr />
  <p>I am setting language for my app. But I have a problem.</p>
  <p>I use <code>React.useContext()</code> to set language. But when I fix it in saga's toast, it log:</p>
  <blockquote>
  <p>[Error: Invalid hook call. Hooks can only be called inside of the body
  of a function component. This could happen for one of the following
  reasons:</p>
  <ol>
  <li>You might have mismatching versions of React and the renderer (such as React DOM)</li>
  <li>You might be breaking the Rules of Hooks</li>
  <li>You might have more than one copy of React in the same app See <a href="https://reactjs.org/link/invalid-hook-call" rel="nofollow noreferrer">https://reactjs.org/link/invalid-hook-call</a> for tips about how to debug
  and fix this problem.]</li>
  </ol>
  </blockquote>
  <p>So <strong>can I use</strong> it in <strong>saga</strong>? If <strong>yes</strong>, <strong>how</strong> should I use it? If <strong>no</strong>, can you suggest me a solution.</p>
  <hr />
  <p>The final solution is props message from saga.</p>
  <hr />
  <p>This is a function of my 'toast.js' file:</p>
  <pre><code>export function toastLoginSuccess() {
    ToastAndroid.show(
      LANGUAGES.toastLoginSuccess,
      ToastAndroid.SHORT,
      ToastAndroid.TOP,
    );
  }
  </code></pre>
  <p>with LANGUAGE is <code>import * as LANGUAGES from '../asset/language';</code></p>
  <p>and <code>toastLoginSuccess</code> is <code>export const toastLoginSuccess = 'Login success!';</code></p>
  <p>I want change it to <code>const LANGUAGES = React.useContext(LanguageContext).language;</code></p>
  <p>And saga is a file similar to:</p>
  <pre><code>export function* fetchSigninSaga(action) {
    try {
      // ...
      yield Toast.toastLoginSuccess())
    } catch (error) {
      // ...
      yield Toast.toastLoginFail();
    }
  }
  </code></pre>