rendering-no-falsy-and — Claude Code rule for JSX
rendering-no-falsy-and is a Claude Code rule that guards against unsafe conditional JSX rendering. It targets cases where a value may be an empty string or zero.
AGPL-3.0 ★ 88 updated 2026-11-17
.claude/rules/rendering-no-falsy-and.mdWhat rendering-no-falsy-and does
The rule flags JSX conditions such as value && <Component /> when the value can be an empty string or 0. React Native may render that falsy value as text outside a <Text> component, causing the app to crash.
It recommends a ternary that returns null, an explicit boolean check with !!, or an early return. The rule describes early returns as the clearest option. The react/jsx-no-leaked-render rule from eslint-plugin-react can also catch this pattern automatically.
What it helps with
- avoid rendering an empty string outside
<Text> - prevent a crash when a JSX condition evaluates to zero
- replace unsafe
value && <Component />checks
Example prompts for the agent
- Check this component for JSX conditions that could render an empty string or zero.
- Replace unsafe
&&rendering checks in this React Native code.
How to install rendering-no-falsy-and
Manually: put the files in place
.claude/rules/rendering-no-falsy-and.mdThe paths frontmatter field limits the files
AGENTS.md
Codex reads AGENTS.md: paste the rule text there
Manually: put the files in place
.cursor/rules/rendering-no-falsy-and.mdcFrontmatter: description, globs, alwaysApply
Manually: put the files in place
.github/instructions/rendering-no-falsy-and.instructions.mdThe applyTo field sets which files it applies to
Manually: put the files in place
.devin/rules/rendering-no-falsy-and.mdManually: put the files in place
.clinerules/rendering-no-falsy-and.mdStep by step, with commands for each platform: AGENTS.md vs CLAUDE.md: what they are and which one to use
Questions about rendering-no-falsy-and
How do I install rendering-no-falsy-and in Claude Code?
Add the rule file at .claude/rules/rendering-no-falsy-and.md.
What does rendering-no-falsy-and do?
It warns against using && for conditional JSX when the value could be an empty string or 0. It suggests a ternary, explicit boolean coercion, or an early return instead.
How can this rendering issue be caught automatically?
Enable react/jsx-no-leaked-render from eslint-plugin-react.