[reactjs] How to use switch statement inside a React component?