The JavaScript array index starts with zero. In React, updating an object in an array will not cause re-renders, adding more complication. Array or array literal ( []) supports a variety of functions to traverse data that can be displayed using HTML elements. Use the Square brackets of access to array items as following below example. index : On which index we need to insert new items. This has the advantage over using concat() of adding elements to the array in place rather than creating a new array. You might know already that array.push(item) method pushes an item at the end of the array, mutating the array upon which the method is called: Then use set () / setValue () to save a user object to the database with the user's username, full name, and birthday. Method 2: Use push () method is used to add element at the end of the array. (See end of answer for how to fix it - create the new obj no matter what, then either push it to the new array, or replace the existing object in the array, without mutating the existing object in the array) It cannot add a new property to a frozen object. (This data will be stored in an array) 2) A user can create some items in each lists. (This data will be stored in an array) 2) A user can create some items in each lists. JavaScript gives us a splice ( ) method by using that we can add new elements into an array at a specific index. Create a react application This method will push the input value into the array and update the state with the new array. If you want to use the JSON data along with the key, then the parse () function can be used. Import JSON Data from Data.json file into State. It is also optimal, because .every() method breaks iterating after finding the first odd number.. 8. If you are new to React Hooks then check out the following articles from beginning. Note: This method changes the length of the array. So how should i insert it into the array.