title: I am using onChange Event but when I am cancelling the changes its not coming back to the original state. Rather its changing the redux state
body: <p>I used on <code>onChange</code> event to take input values and display on the screen. But While doing so I encountered a problem that when I am cancelling the changes its not getting cancelled instead it stores the <code>onChange</code> values. I want to keep the original values when cancelling the event.</p>
  <p><strong>onChange event</strong></p>
  <pre><code>row.edit_mode 
     ?&lt;input type=&quot;text&quot; placeholder=&quot;Enter data&quot; value={value} onChange={(event) =&gt; 
       onTableValueChanged(event, tableIndex, rowIndex, valueIndex)} className=&quot;form-control&quot; /&gt;
     :&lt;span className=&quot;truncate table-truncate ext-data-pr-tooltip&quot; data-pr-tooltip=&quot;value&quot;&gt;{value} 
       &lt;/span&gt;
  </code></pre>
  <p><strong>Fetch details from redix store</strong></p>
  <p><code>const extraction_data = useSelector(state =&gt; state.attachment.extraction.output_json);</code></p>
  <p><strong>state used</strong></p>
  <p><code>const [tableEntities, setTableEntities] = React.useState(extraction_data[currentPage - 1].table);</code></p>
  <p><strong>on Cancel event</strong></p>
  <pre><code>const cancelTableRow = (row, tableIndex, rowIndex) =&gt; {
      let table_entities_cp = [...tableEntities];
      console.log(table_entities_cp);
      let table_entity_cp = table_entities_cp[tableIndex];
      table_entity_cp.rows[rowIndex].edit_mode = false;
      table_entities_cp[tableIndex] = table_entity_cp;
      setTableEntities(table_entities_cp);
    }
  </code></pre>
  <p><strong>onChange Method</strong></p>
  <pre><code>const onTableValueChanged = (event, tableIndex, rowIndex, valueIndex) =&gt; {
        const updatedTableEntities = [...tableEntities];
        updatedTableEntities[tableIndex].rows[rowIndex].data[valueIndex] = event.target.value;
        setTableEntities(updatedTableEntities);
    }
  </code></pre>