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

feat: use React 19 use in useStore api #2755

Closed
wants to merge 1 commit into from
Closed

Conversation

himself65
Copy link
Collaborator

@himself65 himself65 commented Sep 29, 2024

Related Bug Reports or Discussions

Fixes #

Summary

Check List

  • pnpm run prettier for formatting code and docs

Copy link

vercel bot commented Sep 29, 2024

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

Name Status Preview Comments Updated (UTC)
jotai ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 29, 2024 10:10pm

Copy link

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.

Copy link

LiveCodes Preview in LiveCodes

Latest commit: 499d66a
Last updated: Sep 29, 2024 10:10pm (UTC)

Playground Link
React demo https://livecodes.io?x=id/EEQ2CL3RF

See documentations for usage instructions.

Comment on lines +23 to +24
// In React 19, `use` will allow calling within conditionals and loops.
// Refs: https://19.react.dev/reference/react/use#reading-context-with-use
Copy link
Member

Choose a reason for hiding this comment

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

But it doesn't allow calling useStore in a condition. This is pretty unfortunate, but can't be helped.

So, I don't think this PR helps. It rather misleads to misusage.
If you want to use use, the current recommendation is to use custom context on your end.

@himself65 himself65 closed this Sep 29, 2024
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.

2 participants