score:2
Accepted answer
you can't use ||
in case statements, as 'work' || 'vacation'
simply evaluates to 'work'
. using multiple cases will allow you to do what you want:
..
switch (code) {
case 'work':
case 'vacation':
return <workorvacation fieldid={fieldid} />;
case 'sickness:
..
Source: stackoverflow.com
Related Query
- Components not rendered when created dynamically with array.map in react
- Components not rendered dynamically
- Background images for dynamically rendered components not appearing on first render
- React url change but components not rendered until manual refresh
- Passing props to dynamically rendered components in React
- Children of components to do not get rendered
- this.forceUpdate() not re-rendering dynamically created components
- React: Why are these components not updated when useState changes? (components rendered after the app is mounted)
- React Router history.push() changed url but did not rendered components content
- Exit transition not triggered in Framer Motion for React components rendered in Array.map() (or conditionally)
- Changing to '@mui/material' makes the components not rendered
- Specific targeting of CSS classes with Styled Components not being rendered - React
- React component that's rendered dynamically does not rerender on parent state changes
- Pushstate and popstate not working with condtionally rendered components
- React components not rendered on url change with React Router
- React dynamically rendered component not updating
- React.JS - Values not displaying in dynamically rendered list
- Children components are not re rendered on forceUpdate() in React
- Components not being rendered in webpack production build
- I am changing the state, but subscribed components are not rendered
- My components are not being rendered when I click a link that should load them
- React Router 4 links are working but components are not rendered
- What is the best way to show loading screen on every components when component is not fully rendered WITHOUT REPEATING CODES
- not assignable to type 'IntrinsicAttributes & ContentOutlineProps & ContentBrainstormProps' for dynamically rendered component
- I'm using React and my components are not rendered
- React Router Components not being rendered
- Router changes the url but not the components rendered
- Passing props to components rendered dynamically from object
- Conditionally rendered React components not resetting state
- Using electron+react.js, components are not rendered in production version
More Query from same tag
- Play Framework with React in Webjar
- Module not found: Can't resolve 'x' in 'y' from Package Registry
- Redux action return type when using dispatch and getState
- How do I shrink the size of an image in `react-image-gallery`?
- Which Enzyme adapter works with React 17?
- is not assignable to parameter of type [React]
- converted class to hooks, getting Property 'then' does not exist on type '(dispatch: any) => Promise<void>'
- How to make input accept certain extension?
- How to give styles to Fluent UI Components?
- Context API react functional component
- How can I make onClick() not trigger when I click another onClick() inside of it?
- I've got an issue with ReactJS to download a file from Nodejs
- Equal height of details' summary with React
- Have text align with black and white filter
- bind-ed function passed as property React
- Delay in keyboard dismiss react-native
- property 'yyyx' does not exist on type '{}'
- How do I resolve this "'double-conversion Groupcctype' file not found" issue?
- reactjs not updating socketio state properly in useState
- Antd form.item required conditional
- Render key as html property in React
- Changing React Theme Context on button click
- Why capitalize React here? import * as React from 'react'
- React map through two arrays without duplication
- How do I pass a React Context's state through an onClick function created in a method inside that context class?
- How can I declare a variable inside brackets?
- React passing two functions as a call backs to this.setState
- ASP.NET Core DateTime Rest API with Javascript converts to UTC instead of java
- React / Redux conditionally applying style
- Unable to type in an input field when adding item to cart in React