Skip to content

Commit

Permalink
Fixed "setState on unmounted component"
Browse files Browse the repository at this point in the history
Although an unmount mechanism is implemented, we still get the "setState on unmounted component" error.
We have managed to find the problem lying in a typo of the lifecycle method name.
Instead of "componentWillUnMount" it should be "componentWillUnmount".

With this, the error disappears.
  • Loading branch information
Simon Auer authored Mar 24, 2019
1 parent 6089f39 commit 515acde
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export class ProgressiveImage extends React.Component<ProgressiveImageProps, Pro
.then(srcDataURI => !this.unmounted && this.setState({ src: srcDataURI, blur: 0 }));
}

componentWillUnMount() {
componentWillUnmount() {
this.unmounted = true;
}

Expand Down

0 comments on commit 515acde

Please sign in to comment.