Subscribing to External Stores
When React reads data owned by an external store, the subscription must be compatible with React's rendering model. The dedicated external-store subscription API helps React obtain a consistent snapshot and subscribe to changes.
This is particularly relevant to state libraries and applications that integrate existing mutable stores.
The principle is more important than the API name: React needs a reliable snapshot and notification mechanism rather than arbitrary mutable reads during render.
Key Takeaways
- External store integration needs consistent snapshots.
- Avoid reading mutable external state without a subscription model.
- State libraries should integrate with React's scheduling semantics.