How to fix Cannot read properties of null (reading "props") in React | DevErrors