If

The If component allows to use conditions to execute a block of code if a condition is true as a JSX component.

The If component allows to use conditions to execute a block of code if a condition is true as a JSX component.

This component is useful to avoid the use of ternary operators in JSX code.

import { If } from '~/core/ui/If'; <If condition={true}> <p> This content will be displayed </p> </If> <If condition={false} fallback={'I get displayed instead'}> <p> This content will not be displayed </p> </If>

Subscribe to our Newsletter
Get the latest updates about React, Remix, Next.js, Firebase, Supabase and Tailwind CSS