set array of data into mobx array show proxy objects

It depends on how you want to observe the data.

"I'm trying just to set the array of objects I get from api into mobx variable"

is not really your end-goal.

If you want your observers to:

  • option a: react when the array reference change
    = No care for values in the array.
    Use @observable.ref tasks.

  • option b: react when the references of each value in the array change
    = No care for the individual objects properties.
    Use @observable.shallow tasks.

  • option c: react on the individual objects properties too
    = Make everything observable, references and object properties
    Use @observable tasks like you do.

Like indicated in the comments, mobx5 is using Proxy and some behaviour might differ compared to previous version.

More info: Mobx arrays, Mobx decorators, shallow observability

Note: you would need to give more details if this does not help you, like your react component code.


You can convert proxy to JS:

import { toJS } from 'mobx'

// example
toJS(response)