Mobx Out of bounds read: 2 - React-Native

140 Views Asked by At

I am using my mobx in my React-native app.

mobx: "^6.6.2", mobx-react-lite: "^3.4.0",

mobxStore.js

this.arr = [];

getArray(){
   return this.arr;
}


const temp = appState.getArray();

When fetching state array, I am getting this warning many times.

want to remove this multiline warning from mobx. Thank you for further support.

1

There are 1 best solutions below

0
On

I am getting this error since many days and searched a lot to remove this warning and finally i found solution, Here we go.

const temp = appState.getArray().slice();

OR

const temp = appState.arr.slice();

This slice() function will remove it at all.