-
Notifications
You must be signed in to change notification settings - Fork 47.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
create-subscription #12325
create-subscription #12325
Changes from 1 commit
d5d8bf6
7b1e8c2
f8743b3
4304b55
30eb16a
eb1372c
88e7e22
c395051
78c9a4c
d1fc6e8
2e98ca9
5093ab4
54468e8
6b16b7c
d05ffa3
bd36fb4
a11164e
31edf59
256c5e5
6dcac15
39d7ba8
b5571c1
2192fd5
fdfa22b
afeb6cd
7532184
0f936ba
2d824c2
3edff49
e056172
9bdc6d6
9ffe079
629f145
48b4a1b
ee2ae93
64d80b8
ad190fb
3288726
81f2695
267a76b
db7b84f
32d6d40
5557120
ee3dfcc
a2f43a5
4e57ed7
f0c68b8
63a65e6
e6740aa
c116528
c1dd9a7
e10e2fc
f03dfa9
6f740d9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,7 +36,7 @@ npm install create-subscription --save | |
To configure a subscription, you must specify three properties: `getValue`, `subscribe`, and `unsubscribe`. | ||
|
||
```js | ||
import createComponent from "create-subscription"; | ||
import { createSubscription } from "create-subscription"; | ||
|
||
const Subscription = createComponent({ | ||
getValue(source) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For a while, I thought that this function was supposed to be
I'm worried people might do this, though I don't know what to do about it.
…where the source isn't something that offers a way to read the value synchronously. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any actionable suggestion to avoid this? Docs? Method names? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What if we call it 'getCurrentValue'? We could also add a note in the comments saying that this value will be read repeatedly as the component re-renders. |
||
|
@@ -73,7 +73,7 @@ Below is an example showing how `create-subscription` can be used to subscribe t | |
|
||
```js | ||
import React from "react"; | ||
import createComponent from "create-subscription"; | ||
import { createSubscription } from "create-subscription"; | ||
|
||
// Start with a simple component. | ||
// In this case, it's a functional component, but it could have been a class. | ||
|
@@ -147,7 +147,7 @@ Below is an example showing how `create-subscription` can be used with native Pr | |
|
||
```js | ||
import React from "react"; | ||
import createComponent from "create-subscription"; | ||
import { createSubscription } from "create-subscription"; | ||
|
||
// Start with a simple component. | ||
function LoadingComponent({ loadingStatus }) { | ||
|
@@ -187,4 +187,4 @@ const PromiseSubscription = createComponent({ | |
<PromiseSubscription source={loadingPromise}> | ||
{loadingStatus => <LoadingComponent loadingStatus={loadingStatus} />} | ||
</PromiseSubscription> | ||
``` | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
YES! I was going to suggest starting with a concrete example, glad you added this here.