топор ios не работает? я попробовал npminstall ax ios также - PullRequest
0 голосов
/ 06 февраля 2020

я попробовал npm установить топор ios также. Ни один из онлайн-ответов не сработал для меня.

. / Src / component / PostList. js Строка 13: 5: «axois» не определен no-undef

Найти ключевые слова, чтобы узнать больше о каждой ошибке.

PostList. js

    import axios from 'axios'

import React,{Component} from 'react'
class PostList extends Component {
  constructor(props)
  {
    super(props)
    this.state={
      post: []
    }
  }
  componentDidMount(){
    axois.get("https://jsonplaceholder.typicode.com/posts")
  }
  render(){
    return(
      <div>post</div>
  );
  }
}
export default PostList;

json .package

    {
  "name": "axiostry",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@testing-library/jest-dom": "^4.2.4",
    "@testing-library/react": "^9.4.0",
    "@testing-library/user-event": "^7.2.1",
    "axios": "^0.19.2",
    "react": "^16.12.0",
    "react-dom": "^16.12.0",
    "react-scripts": "3.3.1"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": "react-app"
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}

Ответы [ 2 ]

2 голосов
/ 06 февраля 2020

ошибка ввода axois заменить на ax ios

0 голосов
/ 06 февраля 2020

Попробуйте $ npm update или const ax ios = require ('ax ios'). Default;

// ax ios. теперь будет предоставлять автозаполнение и ввод параметров

...