# romac/react-if

🌗 Render React components conditionally

Repository: https://github.com/romac/react-if
Canonical: https://ross.abutalabs.com/products/react-if
Homepage: https://romac.github.io/react-if/
Language: TypeScript
License: MIT
License Family: permissive
Topics: react
Archived: true
Last push: 2026-04-03T21:38:53+00:00

## Health v2 (maintenance only)
Score: 10/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 75, release rhythm 8, longevity 100
- inputs: {"age_days": 4382, "days_push": 152, "days_rel": 463, "gap_med": null, "n_releases_24m": 1}
- flags: archived
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1142, forks 58 (observed 2026-08-28T04:03:44.848188+00:00)

## What it is
A small React component library providing declarative conditional rendering via If/Then/Else JSX components. It makes ternary-based conditional rendering more readable and supports lazy evaluation of children via arrow functions.

## Use cases
- conditionally render react components
- replace ternaries in jsx with readable if/else components
- lazy-evaluate expensive jsx children only when condition is true
- write declarative conditional logic in react templates

## When to choose
- you want more readable conditional rendering than nested ternaries in JSX
- you need deferred evaluation of expensive children or conditions
- you prefer a tiny, dependency-free declarative helper

## When to avoid
- you are fine with plain ternaries or && in JSX
- you want full control over rendering logic without extra components
- your team avoids non-standard JSX abstractions

## Facets
- artifact type: library
- maturity: stable
- function: ui-components, frontend-framework
- domain: frontend, web-development
- platform: browser, cross-platform
- tags: react, conditional-rendering, jsx-components, typescript, nodejs

## Member repositories
- romac/react-if (main) score 10

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:03:44.848188+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T06:35:16.640225+00:00, confidence not recorded.
  - readme: https://github.com/romac/react-if (fetched 2026-08-28T04:03:44.848188+00:00, sha a632d5f8a577)
  - registry_npm: https://registry.npmjs.org/react-if (fetched 2026-08-29T12:40:30.543163+00:00, sha 0644df99d72b)
- Data as of 2026-08-30T08:39:29.467469+00:00.
