Update use-subscription README (#16216)
It was a little confusing that the question asked when NOT to use this package, then the answer says when to use it. I think this is a little better.
Sophie Alpert committed
Jul 25, 2019 at 19:30 UTC
b43785e151a06c91e4c8b3e6e01b615bdc37e33a
1 file changed
+3
-3
packages/use-subscription/README.md
+3
-3
@@ -2,11 +2,11 @@
2
3
React hook that safely manages subscriptions in concurrent mode.
4
5
-## When should you NOT use this?
5
+This utility can be used for subscriptions to a single value that are typically only read in one place and may update frequently (e.g. a component that subscribes to a geolocation API to show a dot on a map).
6
7
-This utility should be used for subscriptions to a single value that are typically only read in one place and may update frequently (e.g. a component that subscribes to a geolocation API to show a dot on a map).
7
+## When should you NOT use this?
8
9
-Other cases have **better long-term solutions**:
9
+Most other cases have **better long-term solutions**:
10
* Redux/Flux stores should use the [context API](https://reactjs.org/docs/context.html) instead.
11
* I/O subscriptions (e.g. notifications) that update infrequently should use a mechanism like [`react-cache`](https://github.com/facebook/react/blob/master/packages/react-cache/README.md) instead.
12
* Complex libraries like Relay/Apollo should manage subscriptions manually with the same techniques which this library uses under the hood (as referenced [here](https://gist.github.com/bvaughn/d569177d70b50b58bff69c3c4a5353f3)) in a way that is most optimized for their library usage.