DEV Community

Simplifying API Calls with URLSearchParams and Fetch

Sanjampreet Singh on August 08, 2023

Have you ever had to deal with complicated query parameters while using GET API calls? Introducing URLSearchParams, a JavaScript interface that m...
Collapse
 
iamhectorsosa profile image
Hector Sosa

Nice post! I've written a simple package to handle URLSearchParams with full type-safety called @search-params/react -> github.com/iamhectorsosa/search-pa....

Check it out and let me know what you think. If you find it useful, I'd appreciate a star on GitHub

Collapse
 
sanjampreetsingh profile image
Sanjampreet Singh

Thanks Hector!!

Collapse
 
webjose profile image
José Pablo Ramírez Vargas • Edited

I suppose the keys and values are URL encoded? This is nice. I had no idea this existed. Had I known, I would have used it in wj-config.

Collapse
 
sanjampreetsingh profile image
Sanjampreet Singh

I would encourage you to read more about it on MDN. Even, I recently discovered this and thought of sharing with the community in a plain language.

Collapse
 
anasouzas profile image
Ana Souza

Nice post! It helped me a lot.