Course Content

  • 5. Iterations and conditions

Course Content


A state object can hold arrays that can be modified when an API or users respond. React uses a shallow comparison to track changes in a state object, which means it doesn't check characteristics of objects when comparing them. This tutorial will show you how to use an array to change the state of a component.

  • Using the index position, get the row and apply it to a new variable.
  • Using the new variable, change the object property.
  • Then, using the index position, assign the modified object to the array.
  • To update the array, use the setter function.

A container object that stores a fixed number of values of a single type is called an array. The length of an array is determined at the time of its creation. Its length is fixed after it is created.

Arrays are a way to store multiple related data in a single variable. They can be used to store any kind of data, like strings, numbers, objects or even functions.

  • Lists: Lists are not indexed by any key and they are ordered by insertion order. Insertion order determines the position of an item in a list, which is determined by its index number.
  • Arrays: Arrays have no indexes, so you cannot determine the position of an item in an array. You can access items at any time using their index numbers or iterate through them using the forEach() function.

Recommended Courses

Share With Friend

Have a friend to whom you would want to share this course?

Download LearnVern App

App Preview Image
App QR Code Image
Code Scan or Download the app
Google Play Store
Apple App Store
598K+ Downloads
App Download Section Circle 1
4.57 Avg. Ratings
App Download Section Circle 2
15K+ Reviews
App Download Section Circle 3
  • Learn anywhere on the go
  • Get regular updates about your enrolled or new courses
  • Share content with your friends
  • Evaluate your progress through practice tests
  • No internet connection needed
  • Enroll for the webinar and join at the time of the webinar from anywhere