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

(refactor/react): Memoize ComponentScope unique value with useState to ensure referential stability. #73

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

iwoplaza
Copy link

Description of the change

According to React Docs, useMemo's result can be forgotten under special circumstances. To avoid this potential behavior, we could use useState to create a stable reference to both the tuple and the generated value at the same time. What do you think?

Type of change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation or Development tools (readme, specs, tests, code formatting)

@loganvolkers
Copy link
Member

Thank you for the PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants