diff --git a/package.json b/package.json index 98c0fa6..1b2bc50 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,7 @@ "@babel/plugin-proposal-class-properties": "^7.0.0", "@babel/preset-env": "^7.0.0", "@babel/preset-react": "^7.0.0", - "@types/react": "^15.0.0", + "@types/react": "^16.0.0", "babel-eslint": "^6.0.0", "babel-loader": "^8.0.2", "eslint": "^1.10.3", @@ -55,8 +55,8 @@ "eslint-plugin-react": "^4.3.0", "file-loader": "^2.0.0", "gh-pages": "^1.2.0", - "react": "^15.0.0", - "react-dom": "^15.0.0", + "react": "^16.0.0", + "react-dom": "^16.0.0", "webpack": "^4.19.0", "webpack-bundle-analyzer": "^3.0.2", "webpack-cli": "^3.1.0", diff --git a/src/index.js b/src/index.js index 5844f4e..4afac22 100644 --- a/src/index.js +++ b/src/index.js @@ -118,7 +118,7 @@ class Avatar extends PureComponent { this.fetch(); } - componentWillReceiveProps(newProps) { + componentDidUpdate(prevProps) { let needsUpdate = false; // This seems redundant @@ -126,7 +126,7 @@ class Avatar extends PureComponent { // Props that need to be in `state` are // `value`, `src` and `color` for (const prop in sourcePropTypes) - needsUpdate = needsUpdate || (newProps[prop] !== this.props[prop]); + needsUpdate = needsUpdate || (prevProps[prop] !== this.props[prop]); if (needsUpdate) setTimeout(this.fetch, 0);