# react-native-conditional-render

> React and React-Native conditional render component

Latest version **1.0.4** (published 2023-10-24) · ISC license · 0 weekly downloads

## Install

```sh
npm install react-native-conditional-render
pnpm add react-native-conditional-render
yarn add react-native-conditional-render
bun add react-native-conditional-render
```

## 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.4 |
| Published | 2023-10-24 |
| First published | 2023-10-23 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 6.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | B.Batgerelt |
| Maintainers | batgerelt |
| Keywords | react, react-native, render, conditional |

## Links

- npm: https://www.npmjs.com/package/react-native-conditional-render
- Repository: https://github.com/batgerelt/react-native-conditional-render
- Homepage: https://github.com/batgerelt/react-native-conditional-render#readme
- Issues: https://github.com/batgerelt/react-native-conditional-render/issues
- npm.io page: https://npm.io/package/react-native-conditional-render

## 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.4 (latest) — 2023-10-24
- 1.0.3 — 2023-10-24
- 1.0.2 — 2023-10-24
- 1.0.1 — 2023-10-23
- 1.0.0 — 2023-10-23

## README

# ConditionalRender Component

[![npm version](https://badge.fury.io/js/react-native-conditional-render.svg)](http://badge.fury.io/js/react-native-conditional-render)
[![npm total downloads](https://img.shields.io/npm/dt/react-native-conditional-render.svg)](https://img.shields.io/npm/dt/react-native-conditional-render.svg)
[![npm monthly downloads](https://img.shields.io/npm/dm/react-native-conditional-render.svg)](https://img.shields.io/npm/dm/react-native-conditional-render.svg)
[![npm weekly downloads](https://img.shields.io/npm/dw/react-native-conditional-render.svg)](https://img.shields.io/npm/dw/react-native-conditional-render.svg)

A React component that conditionally renders content based on boolean conditions.

## Installation

Using npm:

```bash
npm install react-native-conditional-render
```
or using yarn:
```bash
yarn add react-native-conditional-render
```



## Props

- `condition` (boolean, default: `false`): A boolean value determining whether to render content.
- `truth` (React Component): The content to render when the `condition` is `true`.
- `untruth` (React Component): The content to render when the `condition` is `false`.

## Usage ReactJS

```jsx
import React from 'react';
import ConditionalRender from 'react-native-conditional-render';

function MyComponent() {
  const isCondition = true;
  return (
    <div>
      <h1>Conditional Rendering Example</h1>
      <ConditionalRender
        condition={isCondition}
        truth={<p>Condition is true, rendering truth content.</p>}
        untruth={<p>Condition is false, rendering untruth content.</p>}
      />

      <ConditionalRender
        condition={isCondition}
        truth={<p>Condition is true, rendering truth content.</p>}
      />
    </div>
  );
}

export default MyComponent;
```

## Usage React-Native

```jsx
import React from 'react';
import {View, Text} from 'react-native';
import ConditionalRender from 'react-native-conditional-render';

function MyComponent() {
  const isCondition = true;

  return (
    <View>
      <Text>Conditional Rendering Example</Text>
      <ConditionalRender
        condition={isCondition}
        truth={<Text>Condition is true, rendering truth content.</Text>}
        untruth={<Text>Condition is false, rendering untruth content.</Text>}
      />

      <ConditionalRender
        condition={isCondition}
        truth={<Text>Condition is true, rendering truth content.</Text>}
      />
    </View>
  );
}

export default MyComponent;

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