skip to Main Content

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

Javascript – Cannot do npm run

I have a ReactJS project, with package.json file: { "name": "front-end", "version": "0.1.0", "private": true, "dependencies": { "@testing-library/jest-dom": "^5.17.0", "@testing-library/react": "^13.4.0", "@testing-library/user-event": "^13.5.0", "bootstrap": "^5.3.2", "cors": "^2.8.5", "pg-promise": "^11.5.4", "querystring": "^0.2.1", "react": "^18.2.0", "react-dom": "^18.2.0", "react-resizable": "^3.0.5", "react-router-dom": "^6.16.0", "react-scripts":…

VIEW QUESTION
Back To Top
Search