# if.jsx

> Simple if condition helper for JSX

Latest version **1.0.0** (published 2017-06-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install if.jsx
pnpm add if.jsx
yarn add if.jsx
bun add if.jsx
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2017-06-06 |
| First published | 2017-06-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | rogeriopvl |
| Maintainers | rogeriopvl |
| Keywords | jsx, react, if, condition, conditional |

## Links

- npm: https://www.npmjs.com/package/if.jsx
- Repository: https://github.com/rogeriopvl/if.jsx
- Homepage: https://github.com/rogeriopvl/if.jsx#readme
- Issues: https://github.com/rogeriopvl/if.jsx/issues
- npm.io page: https://npm.io/package/if.jsx

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2017-06-06
- 0.0.1 — 2017-06-06

## README

# if.jsx [![Build Status](https://travis-ci.org/rogeriopvl/if.jsx.svg?branch=master)](https://travis-ci.org/rogeriopvl/if.jsx)

Simple if condition helper for JSX.

This module is an implementation of [this tweet][0]. It's highly recommended to read the whole thread, since you may find out that you don't actually need this module.

## Install

    npm install --dev if.jsx

## Usage

```jsx
import If from 'if.jsx'

// ...

return <div className='foobar'>
  {If(showHeader) (
    <h1>Header</h1>
  )}
  <div className='body'>body</div>
</div>
```

#### `If(condition)(children)`

- `condition`: any javascript expression
- `children`: react nodes to render

## License

MIT

[0]: https://twitter.com/svensauleau/status/871825384223985672

---
_Source: https://npm.io/package/if.jsx · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
