Помогите react ts
У меня есть код в который нужно вывести содержимое страницы с localhost:4003, как это сделать?
вот мой код:
import React, { Component } from "react"
const InventoryPage: React.FC = () => {
return (
<div>
</div>
)
}
export default InventoryPage
По дате
По рейтингу
Ой, да Кнопкокрас
import React, { Component } from "react";
const InventoryPage: React.FC = () => {
const [data, setData] = React.useState("");
React.useEffect(() => {
fetch("хттп://localhost:4003")
.then((response) => response.text())
.then((data) => setData(data))
.catch((error) => console.error(error));
}, []);
return (
<div>
<p>{data}</p>
</div>
);
};
export default InventoryPage;
fetch для отправки get запроса