0.1.2 • Published 5 years ago

if-comp v0.1.2

Weekly downloads
15
License
MIT
Repository
github
Last release
5 years ago

if-comp

A very simple component for react when you need to render the component according to the value of the expression.

The target is beautify your code!.

Usage

import React, { Component } from 'react';
import IfComp from 'if-comp';

  const InnerIfComp = () => (
    <IfComp 
      expression={true}
      trueComp={<h3>render true component</h3>}
      falseComp={<h3>render false component</h3>}
    />
  )
  // expression value is true
  <IfComp 
    expression={true}
    trueComp={<h3>render true component</h3>}
    falseComp={<h3>render false component or null</h3>}
  />

  // Render another if-comp
  <IfComp 
    expression={false}
    trueComp={<h3>render true component</h3>}
    falseComp={(
      <div>
        render another if-component
        <InnerIfComp />
      </div>
    )}
  />
0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago

0.0.8

6 years ago

0.0.7

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago