Open aniketsingh98571 opened 3 months ago
We can make use of switch statements if the conditions are too complex and long, Example:-
switch
let componentToRender=null; const admin=true switch(admin){ case true: componentToRender=<Admin/> break; case false: componentToRender=<User/> } return ( {componentToRender} )
File - https://github.com/vasanthk/react-bits/blob/master/patterns/1.conditionals-in-jsx.md
We can make use of
switch
statements if the conditions are too complex and long, Example:-File - https://github.com/vasanthk/react-bits/blob/master/patterns/1.conditionals-in-jsx.md