title: problem implementing "useDispatch" hook with "redux-thunk"
body: <p>I have tried to implement a simple logout functionality using "<strong>useDispatch</strong>" hook. I am using '<strong>redux-thunk</strong>' as middleware. I want to change isAuthenticated in my state using Logout button to false. but I encounter this error:</p>
  
  <p>TypeError: dispatch is not a function</p>
  
  <pre><code>
  // Logout action:
  export const logout = () =&gt; dispatch =&gt; {
    dispatch({ type: LOGOUT });
  };
  
  // Logout reducer:
  case 'LOGOUT':
    localStorage.removeItem('token');
     return {
      ...state,
      token: null,
      isAuthenticated: false,
      loading: false
      };
  
  // inside component:
  const dispatch = useDispatch();
  
  &lt;a onClick={dispatch(logout)} href='#!'&gt;
  </code></pre>
  
  <p>this way of using 'useDispatch' worked just fine when I implemented axios in async format. there is a hint when I hover on useDispatch which states:</p>
  
  <blockquote>
    <p>Note for redux-thunk users: the return type of the returned dispatch
    functions for thunks is incorrect. However, it is possible to get a
    correctly typed dispatch function by creating your own custom hook
    typed from the store's dispatch function like this: <em>const
    useThunkDispatch = () => useDispatch();</em></p>
  </blockquote>
  
  <p>I dont know how can I fix this error: 
  <strong>TypeError: dispatch is not a function</strong></p>
  
  <p>P.S: this is my first question in stackoverflow. :)</p>
  
  <p>many thanks</p>