Back to Errors

You used a value that wasn't there yet

What is this error?

Something was undefined or null when your code tried to read from it. Usually data that hasn't arrived, or a name that's spelled differently than you think.

Common Causes

  • Rendering data before the request finished.
  • The API response shape is different from what you assumed.
  • A typo in a property name.
  • An array was empty and you read [0].

How to fix it (Check First)

  • 1Log the whole object one line above the crash and look at what it actually contains.
  • 2Add a loading state if the data is still in flight.
  • 3Compare the real API response in the Network tab against your assumption.

What NOT to do

  • Do not sprinkle ?. everywhere until the error stops — that hides the missing data, it doesn't supply it.

Technical Details

Property access on undefined/null throws a TypeError at runtime. Optional chaining short-circuits the access but does not resolve the absent state.