title: Why setState changes also the props which i added to the state before
body: <p>Scenario:</p>
  
  <p>I have two components: X and Y. Component Y is the child of component X. </p>
  
  <p>inside X:</p>
  
  <pre><code>&lt;Y data={FormObject} /&gt;
  </code></pre>
  
  <p>Inside the constructor of component Y, I add the prop data (FormObject) to the state of Y which works well. Now after that, if I change the state it affects the props. How? When I close component Y and reopen it I see that the last state is showing up. FormObject isn't like how it was at the beginning. This is because objects are reference types right? </p>
  
  <p>Is there a solution for this? The only solution i found is to do somthing like this:</p>
  
  <p>Inside constructor of Y:</p>
  
  <pre><code>const { data } = JSON.parse(JSON.stringify(this.props);
  </code></pre>
  
  <p>Does it seem like JSON.parse() or JSON.stringify() changed the reference by making a copy with a different memory number?</p>
  
  <p>Is there a better way of doing this instead of the mentioned solution?</p>