Skip to main content
rule CX Codex

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

Install into Claude Code · Manually: put the files in place All methods and platforms ↓
.claude/rules/rendering-no-falsy-and.md
Open on GitHub

What 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.md

The paths frontmatter field limits the files

Step 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.

Similar IDE rules

All IDE rules for Frontend and UI →

From the same set47

The whole set →
js-hoist-intl js-hoist-intl is a Claude Code rule that moves Intl formatter creation out of renders and loops. It applies to JavaScript code that formats dates, numbers, or relative time. CX Codex +1 ★ 88repo stars react-state-fallback react-state-fallback is a Claude Code rule that enforces reactive fallbacks instead of copying props into component state. It prevents stale UI bugs during parent updates. CX Codex +1 ★ 88repo stars list-performance-virtualize list-performance-virtualize is a Claude Code rule that recommends virtualized lists for scrollable content. It applies while building list-based screens. CX Codex +1 ★ 88repo stars react-state-minimize react-state-minimize is a Claude Code rule that enforces minimal React state. It directs assistants to compute values on render rather than storing redundant state variables. CX Codex +1 ★ 88repo stars ui-native-modals ui-native-modals is a Claude Code rule that directs coding assistants to use native React Native modal elements instead of JavaScript-based bottom sheet packages. CX Codex +1 ★ 88repo stars scroll-position-no-state scroll-position-no-state is a Claude Code rule that forbids keeping scroll position in useState. It applies to React Native scroll handlers. CX Codex +1 ★ 88repo stars impeccable-audit impeccable-audit is a Claude Code skill that reviews Mikka interfaces for UX resilience and visual clarity. It audits screens, responsive behavior, accessibility and interface states. CX Codex +1 ★ 88repo stars web-design-guidelines web-design-guidelines is a Claude Code skill that audits Mikka's web interface for accessibility, responsive layouts, forms, and interaction flows. CX Codex +1 ★ 88repo stars

Project sponsors

Companies that keep this analytics open