-
-
Notifications
You must be signed in to change notification settings - Fork 643
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
docs: split atom creators in multiple files #2083
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit c2785d1:
|
@dai-shi the other way I thought of doing it is that we can keep it as it was (just atom-creators.mdx) and import all the creators as components, e.g.
I did it with separate file straight up first, but let me know which one you prefer since I already had both solutions in mind 🙈 |
I think multiple files are better for search. Maybe we should consider about the sidebar labels. @sandren Do you have any idea? |
```js | ||
import { atomWithToggleAndStorage } from 'XXX' | ||
|
||
// will have an initial value set to false & get stored in localStorage under the key "isActive" |
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.
set to false? I don't see the initial value on your code
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.
I think L19 should be initialValue = false,
.
prevVal: Value | ||
) => void | ||
|
||
export function atomWithListeners<Value>(initialValue: Value) { |
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.
I think useCurrentStore
(non-exist API) and store.sub(aAtom)
would be better
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.
This recipe is written for v1 API, I guess. useStore
exists, btw.
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.
This PR is to split markdown files. We should probably open a new PR for improving the contents.
prevVal: Value | ||
) => void | ||
|
||
export function atomWithListeners<Value>(initialValue: Value) { |
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.
This recipe is written for v1 API, I guess. useStore
exists, btw.
```js | ||
import { atomWithToggleAndStorage } from 'XXX' | ||
|
||
// will have an initial value set to false & get stored in localStorage under the key "isActive" |
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.
I think L19 should be initialValue = false,
.
I can do both if you don't mind. I'm still waiting for approval of current changes so I can open a new PR in order to update the docs |
Merged. Thank you so much! 🙂 |
} | ||
``` | ||
|
||
## atomWithRefresh |
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.
@gerzonc It seems like this section is lost. Can you double check please?
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.
True OMG 🥺 I'll add it right away!
Related Issues or Discussions
Closes #2082
Summary
Atom creators file in docs is too big so I just split it in a file per atom creator.
Check List
yarn run prettier
for formatting code and docs