title: Delete item with redux
body: <p>Im trying to delete messages written in a form with react and redux.</p>
  
  <p>The id props is sent correctly as I can see in console, but I only get my error msg when I press the delete button.</p>
  
  <p>This is the button component:</p>
  
  <pre><code>import React from 'react'
  import { useDispatch } from 'react-redux'
  import { messages, fetchDeleteMessage } from 'reducer/messages'
  
  
  export const DeleteBtn = (props) =&gt; {
  
      const dispatch = useDispatch()
  
      const handleDeleteMessageClick = () =&gt; {
  
          dispatch(fetchDeleteMessage(props.message.id))
  
          console.log('delete message', (props.message.id))
      }
  
      return (
          &lt;button className="delete-btn"
              onClick={handleDeleteMessageClick}&gt;
              &lt;span role="img" aria-label="delete"&gt;✖︎&lt;/span&gt;
          &lt;/button&gt;
      )
  }
  </code></pre>
  
  <p>This is my reducer where I try to fetch and delete a specific message upon its id, the id is passed on to the fetch correctly, but nothing happens and I cant see whats wrong and feel I tried it all (....apparently not)</p>
  
  <pre><code>import { createSlice } from '@reduxjs/toolkit'
  
  export const messages = createSlice({
  
      name: 'messages',
      initialState: {
          allMessages: [],
      },
  
  
      reducers: {
  
          deleteMessage: (state, action) =&gt; {
              console.log('deleteMessageState', state)
              console.log('deleteMessageAction', action)
              //finds the task
              //remove it from the array
              state.allMessages = state.allMessages.filter((message) =&gt; message.id !== action.payload)
  
          },
      }
  
  })
  
  
  
  //****** fetch DELETE message ********
  export const fetchDeleteMessage = (id) =&gt; {
      return (dispatch) =&gt; {
          fetch(`http://localhost:3004/messages/${id}`, {
              method: 'DELETE',
              statusCode: 204,
              headers: {
                  'Content-Type': 'application/json'
              }
          })
              .then((res) =&gt; res.json())
              .then(json =&gt; {
                  console.log('DELETE', json, id)
                  dispatch(messages.action.deleteMessage(id))
              })
              .catch(err =&gt; {
                  console.error('error', err)
                  dispatch(messages.actions.deleteMessage({ error: `Error, failed to delete` }))
              })
      }
  }
  `````
  
  </code></pre>