title: React Native : Attempted to assign to readonly property
body: <p>I am trying to check if the entry exists in the AsycStore and if it doesn't exist then, I create an object and set it.
  And there is a return statement that returns the dataobject.</p>
  
  <p>Here is the pseudocode-</p>
  
  <pre><code>AsyncStorage.getItem("dataobject").then((do) =&gt; {
    if(do == undefined)
    {
      console.log("initializing obj + setting data");
      var dobj = "data object";
      dobj.isdirty = true;
      AsyncStorage.setItem("dataobject",dobj);
    }
    return AsyncStorage.getItem("dataobject");
  }).done();
  },
  </code></pre>
  
  <p>I am getting an error in console -</p>
  
  <pre><code>W/ReactNativeJS: 'Error: Attempted to assign to readonly property.\n stack: \n  &lt;unknown&gt;
  
  index.android.bun…:53047\n  tryCallOne                           
  index.android.bun…:5094\n  &lt;unknown&gt;                            
  index.android.bun…:5160\n  &lt;unknown&gt;                            
  index.android.bun…:3399\n  callTimer                            
  index.android.bun…:2954\n  callImmediates                       
  index.android.bun…:3003\n  &lt;unknown&gt;                            
  index.android.bun…:2523\n  guard                                
  index.android.bun…:2452\n  __callImmediates                     
  index.android.bun…:2523\n  &lt;unknown&gt;                            
  index.android.bun…:2503\n  guard                                
  index.android.bun…:2452\n  invokeCallbackAndReturnFlushedQueue  index.android.bun…:2501\n URL: http://localhost:8081/index.android.bundle?platform=android&amp;dev=true\n line: 53047\n message: Attempted to assign to readonly property.'
  </code></pre>
  
  <p>I am not really sure what is the readonly property I am trying to assign. The line number that is being warned is this line - "dobj.isdirty = true";</p>
  
  <p>Should I not add a property to an object? How do I solve this problem? What's the right way of doing it?</p>
  
  <p>Screenshot-</p>
  
  <p><a href="https://i.stack.imgur.com/X79ky.png" rel="noreferrer"><img src="https://i.stack.imgur.com/X79ky.png" alt="Attempted to assign to readonly property width=100"></a></p>