> ## Documentation Index
> Fetch the complete documentation index at: https://docs.formlink.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Pitfall — Cannot read properties of undefined (reading 'title')

> Guard question lookup against null qId and subscribe to runtime state.

# Pitfall — Cannot read properties of undefined (reading 'title')

## Error

* Cannot read properties of undefined (reading 'title')

## Root cause

* `question` was derived from FORM\_SCHEMA instead of the runtime context, or `qId` is null/invalid.

## Fix

// derive qId from the snapshot, and fetch question via runtime
const snap = React.useSyncExternalStore(rt.context.subscribe, rt.context.getSnapshot, rt.context.getSnapshot)
const qId = snap.currentId ?? snap.firstUnansweredId ?? snap.eligibleIds\[0] ?? null
const question = qId ? rt.context.get.q(qId) : undefined
// guard before reading properties
return question ? <h2>{question.title}</h2> : null
