react fetch get request with body with mode cors code example
Example 1: fetch api javascript
fetch('https://apiYouWantToFetch.com/players') // returns a promise
.then(response => response.json()) // converting promise to JSON
.then(players => console.log(players)) // console.log to view the response
Example 2: redirect to website from promise value fetch
fetch("http://example.com/", {
method: 'POST',
mode: 'cors',
body: formData
})
.then(dataWrappedByPromise => dataWrappedByPromise.text())
.then(data => {
//Redirect is the URL inside the text of the response promise
window.location.replace(data);
})