Created
March 14, 2018 20:50
-
-
Save mornir/aa2ce0b156d9d10b116749ac83cfc744 to your computer and use it in GitHub Desktop.
Passing parameters to fetch when making fetch requests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const params = { a: 'foo', b: 'bar' }; | |
const urlParams = new URLSearchParams(Object.entries(params)); | |
fetch('/some/url?' + urlParams); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment