Skip to content
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: add useSetAtom docs #1104

Merged
merged 8 commits into from
Apr 28, 2022
Merged

docs: add useSetAtom docs #1104

merged 8 commits into from
Apr 28, 2022

Conversation

Nsttt
Copy link
Contributor

@Nsttt Nsttt commented Apr 17, 2022

Implements docs for useSetAtom.

Closes #1019

@vercel
Copy link

vercel bot commented Apr 17, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
jotai ✅ Ready (Inspect) Visit Preview Apr 28, 2022 at 1:05PM (UTC)

@codesandbox-ci
Copy link

codesandbox-ci bot commented Apr 17, 2022

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 dd4bf9e:

Sandbox Source
React Configuration
React Typescript Configuration
React Browserify Configuration
React Snowpack Configuration
Next.js Configuration
Next.js with custom Babel config Configuration
React with custom Babel config Configuration

Copy link
Member

@dai-shi dai-shi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on improving docs!

A few requests for changes:

  • useSetAtom is not in jotai/utils so it shouldn't be in utils.mdx or utils folder.
  • It should be in core.mdx, but we need to restructure them to split "Basic APIs" and "Additional APIs" See [RFC] useAtomValue and useSetAtom APIs in core #885. This might sound out of the scope of this PR, but we need the restructure anyway. Sorry, it hasn't be done yet.
  • useUpdateAtom docs should be updated saying useSetAtom is available. Same for useAtomValue in utils. This can be a separate PR.

@Nsttt
Copy link
Contributor Author

Nsttt commented Apr 24, 2022

Hello !

I've made some of the changes you suggested and they seem to work.
Tell me if there's anything else that can be improved.

@@ -1,5 +1,5 @@
---
title: Core
title: Basic
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we keep core.mdx, and have two sections "Basic APIs" and "Additional APIs" in it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, done.

@@ -4,6 +4,8 @@ title: useUpdateAtom

Ref: https://github.com/pmndrs/jotai/issues/26

For newer versions of Jotai it's highly recomended to use [`useSetAtom`](/docs/api/additional.mdx#use-set-atom) instead.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not that "highly". In v1, we keep exporting useUpdateAtom from jotai/utils.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, makes sense. Done.

Copy link
Member

@dai-shi dai-shi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks good. Thanks so much for your contribution.

docs/utils/use-update-atom.mdx Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

useSetAtom doc search can't find description
2 participants