In plain words
In JavaScript, undefined means a value was never set and null means it was set to empty on purpose; reading a property from either one throws an error.
Where you see it
The most common red error in React apps: "Cannot read properties of undefined (reading 'name')". A Guildhall profile page draws itself before the member's data arrives, and member is still undefined when the code asks for member.name.
What goes wrong
- Drawing the page before the data arrives
On the first render, data from Supabase isn't there yet. Code that reads user.name straight away takes the whole page down.
<h1>{user.name}</h1> - Covering every crash with optional chaining
Optional chaining stops the crash but can leave a blank where a name belongs. Decide what the person should see instead: a loading state, a fallback or a clear message.
- Treating 0 or "" as missing
|| replaces anything falsy, so a price of 0 becomes the fallback. ?? replaces only null and undefined.
const price = item.price || 4.99; // a free item now costs 4.99
What to tell your agent
Quick check
Sign in to earn +10 XP for itA free side dish has price 0 in the database, but QuickBite shows 4.99. The code says item.price || 4.99. Why?