Giter Site home page Giter Site logo

pyaesone17 / react-else-if Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 1.0 60 KB

React Conditional Renderer Component that allows you to write jsx like a template engine

License: MIT License

JavaScript 100.00%
react react-condition react-if if-else jsx-syntax react-component

react-else-if's Introduction

React Condition

React Conditional Renderer Component that allows you to write jsx like a template engine. It will be helpful for developer who comes from backend environment.

Installation

npm install react-else-if yarn add react-else-if

Usage

It allows u to render everything like a template engine like this

  import Condition,{If, Else, ElseIf} from 'react-else-if';
  
  <Condition>
    <If is={this.state.authenticated}>
      If condition                       
    </If>
    <Else>
      Else Condition
    </Else>
  </Condition>

It also support for ElseIf block to make ur life more easier.

  import Condition,{If, Else, ElseIf} from 'react-else-if';
  
  <Condition>
    <If is={false}>
      If condition
      <Condition>
        <If is={false}>
          Nested If condition
        </If>
        <Else>
          Nested Else Condition
        </Else>
      </Condition>                        
    </If>
    <ElseIf is={false}>
      Else If condition
    </ElseIf>
    <Else>
      Else Condition
    </Else>
  </Condition>

Note

Since javascript allow you more control, you should still use javascript for render you views. Nothing more, it is just my private component, that i keep using in my project and I want to share.

Future

In the next major version, the package will provide switch statement.

react-else-if's People

Contributors

nyanwin avatar pyaesone17 avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

alisfork

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.