Skip to content

Instantly share code, notes, and snippets.

Last active Oct 12, 2018
What would you like to do?

install create-react-app

npm install -g create-react-app


npm list -g create-react-app
└── create-react-app@1.5.2

build project

create-react-app crud-redux

install redux

npm install --save redux react-redux


npm install material-ui --save
npm install --save-exact @babel/runtime@7.0.0-beta.55
npm add @babel/runtime

restful api tutorial


npm install axios -S

axios TypeError: Cannot read property 'setState' of undefined

The problem is not that the state doesn't exist, it is that you are not using the correct context for state.
You need to bind the axios callback function, otherwise this inside it will refer to its own context rather than that of the react component

change below code

.then(function (response) {


.then((response) => {


git clone
git submodule add
  • Do use below $ yarn add GIT_URL
yarn add

$ vim package.json

  "name": "post-reactjs2",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "babel-eslint": "^9.0.0",
    "babel-jest": "23.6.0",
    "babel-loader": "^8.0.4",    
    "eslint": "5.6.0",
    "light-bootstrap-dashboard-react": "",
    "react": "^16.5.2",
    "react-dom": "^16.5.2",
    "react-scripts": "2.0.4"
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  "eslintConfig": {
    "extends": "react-app"
  "browserslist": [
    "not dead",
    "not ie <= 11",
    "not op_mini all"
rm -rf node_modules
yarn build
yarn start
$ npm install --save react-router-dom


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment