Skip to content

9. Avoid subscribing to state changes unnecessarily

Robin Karlsson edited this page Feb 21, 2023 · 1 revision

Avoid subscribing to state changes unnecessarily: While subscribing to state changes can be useful for updating your application's user interface, it's important to avoid subscribing to state changes unnecessarily. When you subscribe to changes, your listener function will be called every time the state changes, which can impact performance. Only subscribe to changes when necessary, and be sure to remove any listeners that are no longer needed.