score:0
As i have explained already , you can approach this by two methods
you can directly add a
nullchecker
on your component condition.isActive != null && !isActive && <div>show me</div> });
You can directly change the
isActive
variable.const isActive = props.row.original.isActive === false && props.row.original.isActive != null;
and directly add it on the
div
as{ isActive && <div>show me</div> });
score:0
If your case is to check when isActive is null and isActive is not false, then you can make the opposite condition (It's more stright forward and avoiding messing with the undefined/null mismatch):
const isActive = (props.row.original.isActive === false &&
props.row.original.isActive !== null);
Also modify the jsx code for: {isActive && <div> rest of your code }
You can read about the comparisons between undefined and null in MDN docs. for more details about the differences between null and undefined https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/null
Source: stackoverflow.com
Related Query
- How to display an element based on a condition using react and typescript?
- How to display a particular text based on a condition in a reusable component using react and javascript?
- How to display a component when certain condition true using react and javascript?
- How to display the relevant information from object based on selected tabs using typescript and react?
- how to not display an icon based on the props value using react and typescript?
- How to add a link to images based on some condition using typescript and react?
- How to make the API call and display it in React JS using React Table and Axios?
- How to pass additional props throughout a Route element that has parameters in a Typescript based React Web Application
- How to display multiple elements using bootstrap grid system and React Js
- How to access an input element of type checkbox and name using react testing library?
- Unable to figure out how to highlight or select individual objects in InstancedMesh and display custom HTML tooltip using react three fiber
- How to set up a chrome extension using React and TypeScript with multiple pages and entry points?
- How to fix the type error Type '(string | Element) [] is not assignable to type 'string | Element | undefined' using react and typescript?
- How to place the popup based on the position of another div element using javascript and react?
- How to bundle ES6 based React components and keep the bundle in ES6, using webpack?
- How to use ternary operator to display some text instead of using if else conditions in react and typescript?
- How to render jsx only when a condition is true using react and typescript?
- How to add event listener to the div element accessed with ref using react and typescript?
- How to apply a CSS style in React based on condition and incorporate it with another class?
- How to individually change text color and font weight in the same div element using Tailwind CSS and React
- How to fetch data from a custom React hook (API) with onClick and display it in a Div using TypeScript?
- How do I display data from api using react and redux
- How can I test if child React component was rendered based on a URL change using Jest and Enzyme
- How to get the ref.current dom element when using react-select and react refs?
- how to validate date based on input type text and display the day according to input date in react
- How to add an object to an array only if certain condition is true using typescript and react?
- How to list data based on the selected option using react and typescript?
- How to change add margin bottom and margin right if some condition true using typescript and react?
- How to display uploaded and uploading files using react and typescript?
- How to handle display none and block for a View component using react native
More Query from same tag
- ReactJS render a multilevel json structure, unable to show second level data
- How to disable on cloudinary-react video component the download button
- How can I return combined reducers in react-redux?
- React Video Component not updating when state changes
- react-intl - date without day - just month/year
- Pass Accessibility Props to Material UI Button
- How can I upload file from React to Express server?
- React Form value not updating when toggling InputMask mask
- Too many re render Protected Route -ReactJS
- using a variable value on css modules class name
- How to replace a React component
- Mutating nested object
- Property 'value' does not exist on type FormEvent in TypeScript
- react + spring boot upload file and form data
- How to make the Service Worker cache data from API and update the cache when needed
- Reactjs: How to check each of array index containing the value or not?
- Updating object with useState
- Reading and displaying images from a zip file in react using jszip
- Add a class to child component when parent component state changes
- NextJS use client-side error in custom error page
- Is there a way to force a Firebase Authentication ID Token to expire to see how my app would respond?
- React get id value on click
- RefferenceError: Can't find variable React
- Styling ReactSelect with CSS-in-JS
- How to prevent component from re-rendering? (with MWE)
- setState after setState
- pass async results from parent to child component react functional component
- Error of 'TypeError: storage.ref is not a function
- mount() fails because target container is not dom element
- How to send bearer token through header of axios call in react redux