# babel-plugin-jsx-renderif-prop

> A Babel plugin that adds a 'renderIf' prop to JSX elements for conditionally rendering components in React

Latest version **1.4.2** (published 2023-04-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install babel-plugin-jsx-renderif-prop
pnpm add babel-plugin-jsx-renderif-prop
yarn add babel-plugin-jsx-renderif-prop
bun add babel-plugin-jsx-renderif-prop
```

## Health

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

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.4.2 |
| Published | 2023-04-09 |
| First published | 2023-03-31 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 5.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | edan.chetrit@gmail.com |
| Maintainers | chetrit |
| Keywords | babel, babel-plugin, react, jsx, conditional-rendering, renderIf, typescript, es6, transform |

## Links

- npm: https://www.npmjs.com/package/babel-plugin-jsx-renderif-prop
- Repository: https://github.com/chikalaka/babel-plugin-jsx-renderIf-prop
- Homepage: https://github.com/chikalaka/babel-plugin-jsx-renderIf-prop#readme
- Issues: https://github.com/chikalaka/babel-plugin-jsx-renderIf-prop/issues
- npm.io page: https://npm.io/package/babel-plugin-jsx-renderif-prop

## Dependencies (1)

- [@babel/helper-plugin-utils](https://npm.io/package/@babel/helper-plugin-utils.md) ^7.20.2

## 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.4.2 (latest) — 2023-04-09
- 1.3.2 — 2023-04-02
- 1.3.1 — 2023-04-02
- 1.3.0 — 2023-04-02
- 1.2.0 — 2023-04-02
- 1.1.0 — 2023-04-01
- 1.0.0 — 2023-03-31

## README

# babel-plugin-jsx-renderif-prop
A Babel plugin that adds a renderIf prop to JSX elements for conditionally rendering components in React.

## Installation
```sh
npm install --save-dev babel-plugin-jsx-renderif-prop
```
Or
```sh
yarn add --dev babel-plugin-jsx-renderif-prop
```

## Usage
Add the plugin to your Babel configuration:
```json
{
  "plugins": ["jsx-renderif-prop"]
}
```

## Example
With babel-plugin-jsx-renderif-prop, you can conditionally render components using the renderIf prop:
```jsx
const MyComponent = () => (
  <div>
    <div renderIf={firstCondition} {...divProps} />
    <CustomComponent renderIf={secondCondition} {...customComponentProps} />
  </div>
);
```
This will be transformed into:
```jsx
const MyComponent = () => (
  <div>
    {firstCondition ? <div {...divProps} /> : null}
    {secondCondition ? <CustomComponent {...customComponentProps} /> : null}
  </div>
);
```

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