Hey Justin and DevPro Community,
I hope everything is going well.
I have a quick question regarding the Chat App with React and Firebase course - EP Building The Room List Component
Maybe I am missing something here, but I am getting an error on my browser saying that
"TypeError: Cannot convert undefined or null to object"
Could someone assist me in figuring out what is going on? Also, Is there an online repo for the course?
import React from "react";
const Room = (props) => {
return <li>{props.room.title}</li>;
};
const RoomList = (props) => {
const RoomComponents = Object.keys(props.rooms)
.map((roomKey) => {
return {
...props.rooms[roomKey],
id: roomKey,
};
})
.map((roomObj) => <Room key={roomObj.id} room={roomObj} />);
return <ul>{RoomComponents}</ul>;
};
const SideBar = ({ logout, rooms }) => {
return (
<div className="column is-3 hero is-primary">
<h1>Side Bar</h1>
<RoomList rooms={rooms} />
<div className="control">
<button onClick={logout} className="button is-fullwidth">
Logout
</button>
</div>
</div>
);
};
export default SideBar;