Skip to content

Conversation

@pooya-badiee
Copy link
Contributor

Related Bug Reports or Discussions

#755

Summary

Add documentation on how to update values inside arrays while avoiding unnecessary re-renders.
I tried to keep it short, let me know if I can add anything

Check List

  • pnpm run fix for formatting and linting code and docs

@vercel
Copy link

vercel bot commented Jan 10, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
valtio Ready Ready Preview, Comment Jan 11, 2026 0:55am

@codesandbox-ci
Copy link

codesandbox-ci bot commented Jan 10, 2026

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
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.

This looks great to me.
@overthemike Would you like to take a look too?

@pkg-pr-new
Copy link

pkg-pr-new bot commented Jan 11, 2026

More templates

npm i https://pkg.pr.new/valtio@1193

commit: 4802f2a

@overthemike
Copy link
Collaborator

overthemike commented Jan 11, 2026

This is a fantastic start. I think it might be beneficial to add something at the end that explains why it avoids re-renders. Proxy vs Snapshot is the probably the most difficult to understand for newcomers to library. Maybe something like this?

Because the proxy (in this case: state.items[index]) is a proxy object instead of a snapshot object, accessing it does not track usage. This prevents the parent component from "subscribing" to the item's internal changes, effectively isolating updates to the child component.

@pooya-badiee
Copy link
Contributor Author

Thank you @overthemike. I implemented the feedback. Since the FAQ answers were too close together, I merged them into a 'Why It Works' section.
Let me know if it makes more sense

@overthemike
Copy link
Collaborator

LGTM

@overthemike overthemike merged commit 61c5422 into pmndrs:main Jan 11, 2026
33 checks passed
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.

3 participants