switch Blogs
Written by Kiprosh, team of passionate and disciplined craftsmen turning your ideas into reality.
Kiprosh is now part of LawLytics
Written by Kiprosh, team of passionate and disciplined craftsmen turning your ideas into reality.
You might have seen similar code in javascript. I wanted to understand how it is working. As it does not look like a ternary expression. return { "false": React.DOM.a({ href: "javascript:void(0)", onClick: this.linkClicked }, "Click Me Now"), "true": React.DOM.span({}, "You have clicked") }[this.state.clicked]; While discussing with team we found that, it is nothing, but a SWITCH CASE click her to see shorthand for js So when we execute above mentioned code, if "this.state.clicked" is TRUE then it will show SPAN with text 'You have clicked'". This is just