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

Shallow check in object/array destructuring. #70

Closed
heyitsarpit opened this issue Mar 4, 2022 · 1 comment
Closed

Shallow check in object/array destructuring. #70

heyitsarpit opened this issue Mar 4, 2022 · 1 comment
Labels
duplicate This issue or pull request already exists

Comments

@heyitsarpit
Copy link

heyitsarpit commented Mar 4, 2022

Zustand has shallow as the second argument to optimize for referential equality.

Is it possible to do something like that with this library?

  const sdkReader = useSDK((s) => s.sdkReader)
  const sdkWriter = useSDK((s) => s.sdkWriter)

Can we write this in one line with destructuring ?

@dai-shi
Copy link
Owner

dai-shi commented Mar 5, 2022

I found this very controversial, but at this point, I wouldn't do it probably unless React does it.
See #19 for long discussions.

@dai-shi dai-shi closed this as completed Mar 5, 2022
@dai-shi dai-shi added the duplicate This issue or pull request already exists label Mar 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants