title: react native redux: how do I update a specific value in a slice
body: <p>Here's my redux configuration:</p>
  <p><strong>userSlice.js</strong></p>
  <pre><code>import { createSlice } from &quot;@reduxjs/toolkit&quot;;
  
  const initialState = {
    name: &quot;&quot;,
    email: &quot;&quot;,
    avatar: &quot;&quot;,
    id: &quot;&quot;,
  };
  
  
  export const userSlice = createSlice({
    name: &quot;user&quot;,
    initialState: initialState,
    reducers: {
      setUser: (state, action) =&gt; {
        return {
          ...state,
          name: action.payload.name,
          email: action.payload.email,
          avatar: action.payload.avatar,
          id: action.payload.id,
        };
      },
    },
  });
  
  export const { setUser, logout } = userSlice.actions;
  export default userSlice.reducer;
  </code></pre>
  <p><strong>store.js</strong></p>
  <pre><code>import { configureStore } from &quot;@reduxjs/toolkit&quot;;
  import userSlice from &quot;./slices/userSlice&quot;;
  
  export const store = configureStore({
      reducer: {
         user: userSlice,
      },
  });
  </code></pre>
  <p><strong>app.js</strong></p>
  <pre><code>                &lt;Provider store={store}&gt;
                    &lt;Stack.Navigator &gt;
                          &lt;Stack.Screen options={{headerShown: false}} name=&quot;Signin&quot; component={Signin} /&gt;
                          &lt;Stack.Screen options={{headerShown: false}} name=&quot;Home&quot; component={Home} /&gt;
                          &lt;Stack.Screen name=&quot;Profile&quot; component={Profile} /&gt;
                      &lt;/Stack.Navigator&gt;
                  &lt;/Provider&gt;      
  </code></pre>
  <p>Here's some conext:</p>
  <ol>
  <li><p>I Log in then put values into the user slice through the response of the fetch</p>
  <pre><code>                         const newUser = {
                             name: oj.name,
                             email: oj.email,
                             avatar: oj.avatar,
                             id: oj.sub,
                           };
                           dispatch(setUser(newUser));
  </code></pre>
  </li>
  <li><p>After Logging in, I console.log these values this way:</p>
  <pre><code>const user = useSelector((state) =&gt; state.user);
  console.log(user)   
  </code></pre>
  </li>
  </ol>
  <p>And this is what it shows:</p>
  <pre><code>Object {
    &quot;avatar&quot;: &quot;url&quot;,
    &quot;email&quot;: &quot;asd&quot;,
    &quot;id&quot;: &quot;61bcf738e954f7ffc11d507d&quot;,
    &quot;name&quot;: &quot;Asd&quot;,
  }
  </code></pre>
  <p>I want to update <code>name</code> from <code>&quot;name&quot;: &quot;Asd&quot;</code> to <code>&quot;name&quot;: &quot;bill&quot;</code> without changing the others and this is my try:</p>
  <pre><code>const newUser = {                 
  
   name: &quot;bill&quot;
  };
  dispatch(setUser(newUser));
  </code></pre>
  <p>It works, but then the other propeties(email, avatar, id) become undefined. So how can I update a single value without touching the others?</p>