the error is TypeError: Cannot read property 'state' of undefined
Asked
Active
Viewed 153 times
-1
-
Show the code is causing this error – Anatoly Oct 26 '20 at 18:27
-
I posted the function up – Abdallah Hamouda Oct 26 '20 at 20:26
-
Now please add `this.state` definition. And one more thing: don't modify a state directly. Only by using actions and mutations – Anatoly Oct 26 '20 at 20:35
-
[_DO NOT post images of code, data, error messages, etc_](https://stackoverflow.com/help/how-to-ask) – Phil Oct 27 '20 at 02:03
1 Answers
0
Hello inside actions and mutations you need to pass the state to function
First arg u get state action mutations, second one u pass a payload So your code should look like this
gatherine({ state}, payload)
Then you don't need to use this.state and directly use state

Zack Heisenberg
- 499
- 6
- 12