New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

bloom-conditionals

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bloom-conditionals

A ReactJS Conditional Component without external dependencies.

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

bloom-conditionals

Travis npm package Coveralls

A ReactJS conditional rendering higher order component.

Install

with npm

npm install bloom-conditionals

with yarn

yarn add bloom-conditionals

Usage

Simple static values test:

import { Condition, When, Else } from "bloom-conditionals";

const myComponent = (props) => {
    return <Condition test={props.someValue}>
        <When true>I am True</When>
        <When false>I am False</When>
        <Else>I render when no When or NotWhen renders</Else>
    </Condition>
}

Test specific values:

import { Condition, When, Else } from "bloom-conditionals";

const myComponent = (props) => {
    return <Condition test={props.someValue}>
        <When value={true}>I am True</When>
        <When value={false}>I am False</When>
        <Else>I render when no When or NotWhen renders</Else>
    </Condition>
}

Test using functions

import { Condition, When, Else } from "bloom-conditionals";

const myComponent = (props) => {
    return <Condition test={props.someValue}>
        <When value={v => v === true}>I am True</When>
        <When value={v => v === false}>I am False</When>
        <Else>I render when no When or NotWhen renders</Else>
    </Condition>
}

Keywords

FAQs

Package last updated on 26 Sep 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc