import React, { useEffect } from "react";

const App = () => {

useEffect(() => {

const url = "https://example.com";

fetch(url, {

method: "GET",

})

.then((response) => {

if (response.status === 200) {

console.log("Server is up!");

} else {

console.log("Server is down!");

}

})

.catch((error) => {

console.log("Error pinging server:", error);

});

}, []);

return (

Pinging Server

);

};

export default App;

Reply to this note

Please Login to reply.

Discussion

No replies yet.