Newfangled Package Modernizer
Wondering what’s next for npm?Check out our public roadmap! »

react-switch_case

1.0.1 • Public • Published

react-switchCase

  • npm install react-switch_case or yarn add react-switch_case
 import Switch from 'react-switch_case'
 const Case=Switch.Case
 function handle(value){
    return ['3','4','5'].includes(value)
 }
 <Switch value="1">
     <Case value="1" style={{color:'red'}}>aaa</Case>
     <Case value="2">aaa</Case>
     {
        //value can be a function
     }
     <Case value={handle}>aaa</Case>
     {
        //default
     }
     <span>default case</span>
 </Switch>

Install

npm i react-switch_case

DownloadsWeekly Downloads

6

Version

1.0.1

License

ISC

Last publish

Collaborators

  • avatar