eolas/neuron/cad1eefd-a429-432d-ab3c-0841f6b6f238/React_errors.md

21 lines
626 B
Markdown
Raw Normal View History

2024-12-09 18:34:15 +00:00
---
tags:
- javascript
- react
---
# Errors
## State update on unmounted component
> Can't perform a React state update on an unmounted component. This is a no-op,
> but it indicates a memory leak in your application. To fix, cancel all
> subscriptions and asynchronous tasks in a useEffect cleanup function.
This typically happens when you have an API request running in the background.
Once the data is returned, React tries to update the state but the component is
unmounted.
As the warning suggests, this can be resolved using the cleanup parameter within
[React_useEffect](React_useEffect.md#cleanup-functions).