Skip to content

.tip

· one of the small things

Let a feature render nothing when it cannot work

A component that renders an empty box when its data is missing looks broken. One that returns null just looks like the feature isn't there, which is a perfectly good state to be in.

const summary = await threadSummary(id);
if (!summary) return null;

Design the empty state on purpose, in code, before the day the upstream goes down.

reactreliability

Longer version: the post this came from.