How to update single value inside specific array item in redux : <p>I have an issue where re-rendering of state causes ui issues and was suggested to only update specific value inside my reducer to reduce amount of re-rendering on a page.</p>

<p>this is example of my state</p>

<pre><code>{
 name: "some name",
 subtitle: "some subtitle",
 contents: [
   {title: "some title", text: "some text"},
   {title: "some other title", text: "some other text"}
 ]
}
</code></pre>

<p>and I am currently updating it like this</p>

<pre><code>case 'SOME_ACTION':
   return { ...state, contents: action.payload }
</code></pre>

<p>where <code>action.payload</code> is a whole array containing new values. But now I actually just need to update text of second item in contents array, and something like this doesn't work</p>

<pre><code>case 'SOME_ACTION':
   return { ...state, contents[1].text: action.payload }
</code></pre>

<p>where <code>action.payload</code> is now a text I need for update.</p>
