How to fix Cannot access "this" in arrow function outside of class component context in React | DevErrors