Option in <Link> component to maintain certain search params #3647
brightpixels
started this conversation in
General
Replies: 2 comments 1 reply
-
You should not use the search params as a persistent way to keep the user preferred locale, use a cookie or the session instead. |
Beta Was this translation helpful? Give feedback.
1 reply
-
I have a helper function |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
When we toggle language, we do it via the url as
?lng=en
(using remix-i18next lib). However, the lang search params disappears from the url when a link on the page is clicked on that has it's own search params (like pagination) which means language is reset back to the default (this also happens on form submission that redirect to a new page if successful or reloads with errors). I think this is intentional by Remix? To get around this, we are having to useSearchParams and if there is a lng present, then to append it ourselves manually. Doing this for all links is a big overhead. I was wondering if there is any plans to make this type of thing easier?Beta Was this translation helpful? Give feedback.
All reactions