0.0.3 • Published 8 years ago

jsx-switch v0.0.3

Weekly downloads
6
License
MIT
Repository
github
Last release
8 years ago

jsx-switch

Simple switching for React JSX

Found a bug? Got a feature request? Submit an issue!

Installation

Install locally.

npm install jsx-switch --save

Requires React 15.0.0 or later.

Usage

import { Switch, Case, Default } from 'jsx-switch';

function MyComponent() {
  return (
    <Switch>
      <Case expr={...}>
        <Component1 />
      </Case>
      <Case expr={...}>
        <Component2 />
      </Case>
      <Case expr={...}>
        <Component3 />
      </Case>
      <Default>
        <Component4 />
      </Default>
    </Switch>
  );
}