Replies: 1 comment 1 reply
-
What's the alternative / idea here? Also - this seems like a topic more suitable for a more general React discussion? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
In class components, UNSAFE_componentWillReceiveProps allows developers to respond to every prop update, even if the update does not cause a re-render. This is crucial for scenarios where props are used as control signals for side-effects (e.g., triggering animations, API calls, or hardware events) without being directly used in render.
Modern alternatives like getDerivedStateFromProps and componentDidUpdate either:
Lack access to this (static method) or
Only trigger after a render, leaving “blind spots” for prop-driven side-effects.
This gap makes it difficult to migrate safely from UNSAFE_componentWillReceiveProps in real-world apps where props carry non-render data flow.
Beta Was this translation helpful? Give feedback.
All reactions