Skip to content

useMemo inside useState in example #976

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

Open
MohammadAzimi opened this issue Mar 5, 2025 · 0 comments
Open

useMemo inside useState in example #976

MohammadAzimi opened this issue Mar 5, 2025 · 0 comments
Labels
question Further information is requested

Comments

@MohammadAzimi
Copy link

Ask your Question

There's a useNavigationPanel hook in the hook folder of the example project. I was trying to get deep in how to use the react-native-pager-view and I saw this useMemo as the initializer of useState.
Is it a mistake? What kind of syntax is it and what is the reason?
As far as I know, the useState initializer executes just once before the first render and will not execute again unless the component remounts.
So if it's on purpose, then please explain it. Otherwise, I can create a PR and change it to a normal useState

@MohammadAzimi MohammadAzimi added the question Further information is requested label Mar 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant