You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

react-select-case

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-select-case

A simple way to do select case logic inline in a react component

1.0.1
latest
Source
npmnpm
Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source

react-select-case

A simple way to do select case logic inline in a react component

Frequently react components want to render different content based on a value of an expression. This can be done with if statements and variables, but that is often overkill for simple uses. This library provides a simple API for this kind of logic.

Install

npm install --save react-select-case

An Example

This will report whether the time in epoch millis was odd or even when the component was rendered.

<Select on={ (+new Date) % 2 }>
  <Case when={ 0 }>
    Time is even
  </Case>
  <Case when={ 1 }>
    Time is odd
  </Case>
</Select>

FAQs

Package last updated on 09 Feb 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