How to fix Cannot read property "current" of null in React | DevErrors