1.1.1 • Published 3 years ago

recond v1.1.1

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

iscanyc/recond

npm NPM npm

Recond makes react conditional render flexible. It is closer to if else statements.

Example

Renders CondOne.

<Recond
  methods={{
    CondOne: () => "Hello!",
    CondTwo: () => "Hey.",
  }}
  conditions={{
    CondOne: true,
    CondTwo: true,
  }}
/>

Renders CondTwo.

<Recond
  methods={{
    CondOne: () => "Hello!",
    CondTwo: () => "Hey.",
  }}
  conditions={{
    CondOne: false,
    CondTwo: true,
  }}
/>

If doesnt match any condition, you can use defaultMethod. Now defaultMethod is rendered.

<Recond
  methods={{
    CondOne: () => "Hello!",
    CondTwo: () => "Hey.",
  }}
  conditions={{
    CondOne: false,
    CondTwo: false,
  }}
  defaultValue="Hey, this is default value"
/>
1.1.1

3 years ago

1.1.0

3 years ago

1.0.0

3 years ago