In javascript you can check a value is object with this way
typeof yourVariable === "object" && yourVariable !== null;
Note: In Javascript null is considered as an object. So you must include yourVariable !== null
.
Created with ❤️ using Next.js & Tailwind CSS