How to fix Cannot access ref.current in forwardRef before component renders in React | DevErrors