How To Check If Array Or Object Is Empty In React Js

In this quick example i will show you how to check if object is empty or not in react js. Before mapping the array we have to check or it is good to check that the data array is empty or not in react js.

In this example you will learn that how we can check it whether how to check if json object is empty in react. We can use vanila JavaScript length property check whether the array or object is empty in Reacjs. In this tutorial, i will discuss you empty array is empty or not in reactjs.


import React from 'react'

export default class Home extends React.Component{
        var myArr = [];

        if(myArr.length > 0){
            var items = =>
            var items = "Array is Empty"



Hope it can help you.