Does react-native not support javascript's Map()? The following code is returning an empty object:
const x = new Map()
x.set(1, 'a')
x.set(2, 'b')
console.log(x)
Does react-native not support javascript's Map()? The following code is returning an empty object:
const x = new Map()
x.set(1, 'a')
x.set(2, 'b')
console.log(x)
react-native only supports a subset of Javascript functionality as listed here. This may explain the reason for the unexpected behaviour.
To achieve this what you're requiring in your react-native app, you could use an object to map key/value pairs in a similar way like so:
const x = {};
x[1] = 'a';
x[2] = 'b';
console.log(x);