Hi, I am developing a hotel booking website as a student project using the MERN stack (MongoDB, Express, React, Node.js). When I try to register a new hotel, I get the following error on the frontend:
Cannot read properties of null (reading ‘id’)
The error message appears after I click the “Register” button on my registration form. All form fields are filled out (see screenshot attached).
Frontend: React.js
Backend: Node.js/Express
Database: MongoDB
The error occurs when submitting the hotel registration form.
I am not sure if the problem is in my backend response or the frontend handling of the response.
Screenshot attached.
Can anyone help me understand what might be causing this and how to fix it?
Thank you!