Quantcast
Channel: Active questions tagged javascript - Stack Overflow
Viewing all articles
Browse latest Browse all 138163

axios is not working? i tried npminstall axios also

$
0
0

i tried npm install axios also. None of the answers which are online worked for me.

./src/component/PostList.js Line 13:5: 'axois' is not defined no-undef

Search for the keywords to learn more about each error.

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"
    ]
  }
}

Viewing all articles
Browse latest Browse all 138163

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>