title: Function won't send Redux Dispatch after a Fetch Delete Request in React
body: <p>I submit a delete request to my backend onClick and when I get the response from the server, I try to call a dispatch function to update the Redux store. The backend data can delete the request effectively; however, when I include the dispatch call, React gives me this error: </p>
  
  <pre><code>  ./src/actions/questions.js
    Line 68:  'dispatch' is not defined  no-undef
  </code></pre>
  
  <p>I've tried tons of different syntax and .then combinations after response is received but nothing works. This is confusing to me because in the thunk fetch calls I make, I'm able to call dispatch when I get the response. I'm not able to use the traditional thunk syntax because it won't fire the request since it initially is trigged in an onClick event in a component. So, the delete fetch request I am making looks like this:</p>
  
  <pre><code> export function deleteQuestion(questionId, routerHistory) {
       return fetch(`${API_URL}/questions/${questionId}`, {
           method: 'DELETE',
       }).then(res =&gt; 
       dispatch(removeQuestion(questionId)))
     }
  </code></pre>
  
  <p>I've thought about just dispatching removeQuestion outside of the method, but then I worry that the Redux store would become out of sync with the backend data and cause problems later. I'd greatly appreciate any insight anyone could provide. I do not think deleting an item and updating the Redux store should be so challenging. </p>
  
  <p>This is the github as well: <a href="https://github.com/jwolfe890/react_project1/blob/master/stumped-app-client/src/actions/questions.js" rel="nofollow noreferrer">https://github.com/jwolfe890/react_project1/blob/master/stumped-app-client/src/actions/questions.js</a></p>
  
  <p>Thank you again. </p>