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

Order

import { Order } from 'flowr';

Order will rearrange the children based on a specified order. The sort prop will take an array of indices that map to the children indices. The children order will be the same as the position of their index inside the array.

If the sort prop is not provided, the children order will remain unchanged.

A B C
// will render:
B C A

Any index that will not have a corresponding child will be ignored. Likewise, any index that is left out will result in that child not being rendered.

// sort={[1, 2, 0, 3]}
// will render:
B C A
// sort={[2, 0]} // will render:
C A

Props

NameTypeDefaultDescription
sortarray-An array containing the children indices sorted by the order in which we want them to be rendered.

See also Flip, Reverse

Contribute on Github! Edit this section.