Skip to content Skip to sidebar Skip to footer

Encoding Uri Using Link Of React Router Dom Not Working

I want to encode uri, using Link tag of react-router-dom but when I use javascript encodeURIComponent to encode uri it does not show encoded uri in address bar(url bar) though i se

Solution 1:

The Link in react router dom decodes the uri while pushing it to history. Anybody can read this issue in github and related issues Path is decoded in createLocation #505https://github.com/ReactTraining/history/issues/505

I did workaround of this issue by double encoding the uri so that it is decoded once while pushing in history. encodeURIComponent(encodeURIComponent(item.url)) till now I have not found any side effects of this....hope this helps anybody facing this issue.

Post a Comment for "Encoding Uri Using Link Of React Router Dom Not Working"