jsx-switch
v0.0.3
Published
Simple switch statements for React JSX
Downloads
3
Maintainers
Readme
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>
);
}