title: Updating Redux State from response data
body: <p>I have a login/signup system for my React App.</p>
  <p>I want to set the <code>user</code> state to the response recieved after <code>fetch</code>. The code looks like this -</p>
  <pre><code>export const userSlice = createSlice({
    name: &quot;user&quot;,
    initialState: {
      user: null,
    },
    reducers: {
      login: (state, action) =&gt; {
        fetch(&quot;http://localhost:5000/user/login&quot;, {
          method: &quot;POST&quot;,
          headers: { &quot;Content-Type&quot;: &quot;application/json&quot; },
          body: JSON.stringify(action.payload),
        })
          .then((res) =&gt; {
            return res.json();
          })
          .then((data) =&gt; {
            console.log(data);
            state.user = data;
          });
      },
    },
  });
  </code></pre>
  <p>Everything works fine until I add the line <code>state.user = data</code> , after which I get an error which says -</p>
  <p><strong>Unhandled Rejection (TypeError): Cannot perform 'set' on a proxy that has been revoked</strong></p>
  <p>What am I doing wrong?</p>
  <p>Thanks in advance.</p>