flowr

  • Docs
  • Examples
Docs Menu
  • Getting started
  • Conditionals
    • Maybe
    • Either
    • Flip
    • Reverse
    • Order
    • One
    • Some
    • Constant
    • Just
    • Nothing
    • Pure
  • Schedulers
    • Await
    • Stream
    • Delay
    • Debounce
    • Throttle

Either

import { Either } from 'flowr';

An Either is like a regular if/else statement When the predicate is true, it will render the first child, otherwise it will render the second.

Either will only consider the first two children, everything else will be ignored. You can use a any other wrapping element or a `Fragment` to get around this limitation.
A B
// for predicate === true:
A
// for predicate === false:
B

Props

NameTypeDefaultDescription
whenbooltrueWhen this is true, render the first child element. If false, render the second.

See also Maybe

Contribute on Github! Edit this section.