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

Cannot Fetch Query Parameters #14

Closed
SarthaKashmira opened this issue Feb 11, 2025 · 10 comments
Closed

Cannot Fetch Query Parameters #14

SarthaKashmira opened this issue Feb 11, 2025 · 10 comments
Assignees

Comments

@SarthaKashmira
Copy link
Owner

Inside Home/index.jsx my query parameters are changing whenever I am entering any data inside the Input tag.But on re rendering the component the latest values are not being fetched by the useQueryParams() custom hook from the url.

@SarthaKashmira
Copy link
Owner Author

@jaimysimon I am having the above problem. Can you please have a look.

branch - https://github.com/SarthaKashmira/Cinesearcher-Sarthak-Kashmira/tree/13-add-pagination-and-query-params

@jaimysimon
Copy link
Collaborator

Can you add a NeetoRecord video explaining exactly what the problem is? For me, it is working as expected, so maybe I didn’t understand the issue correctly.

@SarthaKashmira
Copy link
Owner Author

SarthaKashmira commented Feb 12, 2025

@jaimysimon
Copy link
Collaborator

@SarthaKashmira
Copy link
Owner Author

SarthaKashmira commented Feb 12, 2025

@jaimysimon
But since I am setting the searchKey every time ,the component is rendered again which is invoking the useLocation hook every time inside useQueryParams custom hook.

@jaimysimon
Copy link
Collaborator

Yes, it invokes useLocation, what I meant is location.search and history.location.search is out of sync.

@SarthaKashmira
Copy link
Owner Author

@jaimysimon
It worked when I changed the code inside the useQueryParams custom hook of location.search with history.location.search.
I will study the difference between both of them while invoking or when the url is changed.

@jaimysimon
Copy link
Collaborator

@SarthaKashmira
Copy link
Owner Author

SarthaKashmira commented Feb 12, 2025

Actually I read about it and it clearly specified that useLocation can access current url string ,therefore I searched on whether it doesnt work due to version issue as now 7 version of react router is published and we were using 5 version.Therefore my head was all around useLocation only.
I will refer the above article

@jaimysimon
Copy link
Collaborator

jaimysimon commented Feb 12, 2025

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

2 participants