score:0
Accepted answer
we cant directly render empty object in jsx. we can do like that or use empty string
export default function app() {
let load = true;
return (
<div classname="app">
{load === true ? <h1>loading... </h1> : <h1>no data</h1>}
</div>
);
}
Source: stackoverflow.com
Related Query
- ReactJS Functional Component vs Component Functions for conditional rendering
- conditional functional component rendering in ReactJS
- ReactJs - Conditional Rendering or hiding component
- "Unexpected token, expected ," when I try to do conditional rendering in react with stateless functional component
- Conditional rendering from a functional component
- conditional rendering of the same component with different props does not unmount the component in ReactJS
- conditional rendering is not working in my functional component
- ReactJS - Test conditional rendering in component
- ReactJS Best way to conditional rendering component with props
- Rendering the functional component is not the same with class component in ReactJS
- ReactJS component not rendering textarea with state variable
- How to style a functional stateless component in Reactjs using classes object
- how to use in Reactjs functional component history.push
- Class based component vs Functional components what is the difference ( Reactjs )
- functional component set useState in conditional function
- why do functional component in reactjs not have instances?
- Rendering children props in pure ReactJS (functional) component
- Typescript + React, rendering an array from a stateless functional component
- Dynamically rendering component from string: ReactJS
- ReactJS component rendering and how to append elements to the div the component is mounted on
- Endless loop rendering component on ReactJs
- ReactJS - load the data before rendering the component
- How to implement conditional rendering while the children component calling useState() in react hooks?
- Conditional rendering not displaying - ReactJS
- react - conditional rendering inside component return function
- Writing a ReactJS component that branches rendering
- How to add action to functional component using Redux and ReactJS
- ReactJS conditional rendering IF/OR
- Gatsby conditional rendering of a component
- ReactJS conditional component display
More Query from same tag
- React child component receives object. Why there is no visual update upon change of just one attribute of the object?
- reuse Modals in React
- React: server side rendering, Invariant Violation: Invalid tag: <!doctype html>
- Problem when updating a value in multiple places on redux
- ReactJS - After .setState called successfully other properties become undefined
- Managing React states correctly giving strange error
- How to use React Router with Laravel?
- In Redux, how to retrieve values from an API and show the result in the component
- React defining functions at file scope in functional component
- TypeError: Cannot read property 'name' of null in react
- Uncaught TypeError: Cannot read property 'balance' of undefined
- Observable.timer is not triggered in React application
- Problem of map function when try to add conditions in React
- Why use Next.js API route with an external API?
- Reduce duplicate codes on switch case on React prop value improve code resuability
- How not to display button on certain specific pages?
- reactjs image slider navigation function, cant seem to get it working properly
- Ant Design table continues to show loading even when the table is populated by data
- Globally imported variables are undefined
- Redux managing a string always returns "undefined"
- How to write to text file in React
- How to avoid line break in Typography
- React CSSTransition with Route renders next page first then works with rendering next page again
- Can't get my form in React to work properly
- How to include Preact component with hooks in React app?
- I am getting (TypeError: Cannot read property 'down' of undefined)
- Array manipulation/mapping returning undefined
- how should I fix these styling problems with styled-component
- React Redux pass props to other component enhancer
- React, React Router and Flux: “dispatch in the middle of a dispatch” when I try to clear the messages on store