[Vuejs]-Vue Native: attempted to assign to readonly property

1👍

This was a lack of oversight on my part. The docs state:

static setItem(key: string, value: string, [callback]: ?(error: ?Error) => void)

Simply put – only strings can be stored using AsyncStorage.
This problem has been addressed before here and here.

The solution is simple:

AsyncStorage.removeItem('APIs').then(() => {
    AsyncStorage.setItem('APIs', JSON.stringify(context.state.apiList));
});
👤yarex

Leave a comment