I have this object
const data = {
users: require("../model/users.json"), // initial value
setUsers: (newUsers) => {
this.users = newUsers
}
}
The setUsers arrow function doesn't assign newUsers to this.users, like it doesn't have access to this.users. But if I change setUsers to a regular function it works.
setUsers: function (newUsers) {
this.users = newUsers
}
Now it assigns newUsers to this.users. Why it does that, I thought arrow functions and regular functions are the same?