An open API service indexing awesome lists of open source software.

https://github.com/delpikye-v/react-if

React wrapper conditions. Simple wrapper
https://github.com/delpikye-v/react-if

react-condition react-if react-if-else

Last synced: 4 months ago
JSON representation

React wrapper conditions. Simple wrapper

Awesome Lists containing this project

README

          


react-ifz


react-ifz




LIVE EXAMPLE


[![NPM](https://img.shields.io/npm/v/react-ifz.svg)](https://www.npmjs.com/package/react-ifz)
[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
![Downloads](https://img.shields.io/npm/dt/react-ifz.svg)

---
## Description
+ React wrapper conditions
+ If/ElseIf/Else
+ Switch/Case

## Installation

install via npm:
```
npm i react-ifz
```

## Usage

#####
```js
import { Case, Else, ElseIf, If, Switch, Then, When, Default } from 'react-ifz';

const [statez, setStatez] = useState(1);

setStatez(statez + 1)}>Click

// Single => should use this instead of

when: statez === 1

// ****************************************************************
// ****************************************************************
// ****************************************************************

if: statez === 1

if: statez === 2


statez === 3


statez === 4


statez === 5

state other any

// ****************************************************************
// ****************************************************************
// ****************************************************************


Case 7


Case 8

{/*
Case === 9
Case === 10
Case === 11
{/* */}
*/}

// ****************************************************************


Case 7


Case 8

{/*
Case === 9
Case === 10
Case === 11
*/}
{/* */}

```

## Note
```js
// => you should not write condition like this, even if it is supported.


statez === 2: else-if // not rendered


state other 2 // => Render if condtion !==2 and elseIf not true

state other 2 // => Render if condtion !==2

//***** */
// support tag: but you should not use it.

```

## License

MIT