Skip to content
/ recond Public

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

Notifications You must be signed in to change notification settings

iscanyc/recond

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 defaultValue. Now defaultValue is rendered.

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