React get array length

May 15, 2020



Hello Friends,

We can use length method in react js for get length of array. many times rwe required array length for count. Here in this tutorial, we are going to explain how you can get the length of array. length is javascript method for count number of element in array. you can also get react state array length using this method.

Using this demo you can use the length method to count the number of items in an array. I want to know how many rows it's rendering. Get size of array returned by map in React render. react array length 0.


import React from 'react'

class ArrayLength extends React.Component{


var myArray = [1,2,3,4,5,6,7,8];

var result = myArray.length;



<h4>Array length is { result }.</h4>





export default ArrayLength;

I hope it can help you...