skip to Main Content

Reactjs – Set new state in object in array

I have a problem with updating my object in array. const [list, setList] = useState([]); const changeRecordIndex = list.findIndex((recordItem) => recordItem.id === recordID); I creat new array, copy object wich i need and then change one parametr of object. It's…

VIEW QUESTION

Reactjs – why the first value of this.state array is undefined?? React

import React, {Component} from "react" import './index.css'; export default class ListArticle extends Component { constructor(props) { super(props); this.state = { arrayJson: [""], } } get() { fetch("http://localhost:8080/getHeaders", { method: "GET" }) .then(data=>data.json()) .then((data)=>{ this.setState({arrayJson:data.headerArray}) } ) } componentDidMount() { this.get();…

VIEW QUESTION
Back To Top
Search