I am new to reactJS. The below snippet is to invoke a URL on a click event. But the URL fired is with the baseURI.
How can i truncate that or reset it ?
handleClick = (event) => {
console.log("Got the row " + event );
alert('The link was clicked.'+ event);
fetch("www.google.com")
.then(res => {
console.log("Got the result "+ res.json());
}
);
};
The URL fired is
Response:
{type: "basic", url: "http://localhost:3000/www.google.com", redirected: false,
status: 200, ok: true, …}
(...)
statusText: "OK"
type: "basic"
url: "http://localhost:3000/www.google.com"
I need to fire multiple calls within this handleClick event and then open a new tab if successful with the final URL along with the session key. The above code is just the beginning to check the calls work fine or not.
How should i truncate "http://localhost:3000" ??