Why am i getting the error Age is not defined? [Solved] | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Why am i getting the error Age is not defined? [Solved]

I am using immer library produce function in reducer which I think is causing error ,maybe because of improper usage ,can anyone help me by pointing out what I might be doing wrong ?Ty! https://code.sololearn.com/W0kIypG3TN5n/?ref=app

26th Aug 2020, 7:58 PM
Abhay
Abhay - avatar
2 Answers
+ 4
Tiny fix: Line 56: return inner.Produce(...) Abhay The reducer must return the next state.
26th Aug 2020, 8:16 PM
Kevin ★
+ 3
Kevin ★ thanks a lot Kevin ,I went through so many tutorials but didn't noticed anyone returning immer!! Edit:oh ok thks ,also I see now that others were using arrow function without curly brackets so it was automatically returning the new state
26th Aug 2020, 8:22 PM
Abhay
Abhay - avatar