avant-case
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

avant-case

A conditional rendering component to improve readability, the nomenclature is based on proposal pattern matching

examples:

default:

<Case>
    <When 
      is={} //boolean variable
      render={() => Element} // a function that returns one or multiple JSX elements
    />
    <When 
      is={} //boolean variable
      render={() => Element} // a function that returns one or multiple JSX elements
    />
</Case>

non exclusive:

<Case nonExclusive>
    ...
</Case>

By default, the Case component get the first truthy condition and return as fast as possible, but sometimes we need to render more than one When conditions, to enable it, just add nonExclusive prop on Case component

Readme

Keywords

none

Package Sidebar

Install

npm i avant-case

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

3.26 kB

Total Files

8

Last publish

Collaborators

  • avantstayinc