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

'Recent Searches' example flips history order on every re-render #438

Open
alexnaglotech opened this issue Jan 24, 2025 · 0 comments
Open

Comments

@alexnaglotech
Copy link

alexnaglotech commented Jan 24, 2025

The Recent Searches example given in the how-to guides uses .reverse() which reverses the array in place. This means on every render (ie. each letter typed) the order of recent searches gets flipped. An easy way around this is to use .toReversed() to create a new instance of the array in reverse order, with the caveat that this is only supported in browsers from ~2023 onwards.

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

No branches or pull requests

1 participant