Added backend+database support

This commit is contained in:
Daniel
2022-04-19 16:52:53 +04:30
parent 663b83b361
commit f39baae69b
18 changed files with 1377 additions and 29 deletions
+51
View File
@@ -0,0 +1,51 @@
import { useEffect, useState } from 'react';
import './App.css';
import List from './componets/List';
function App() {
const [data, setData] = useState([]);
useEffect(() => {
async function fetchData() {
const res = await fetch('/get');
const resJSON = await res.json();
console.log(resJSON)
setData(resJSON);
}
fetchData();
}, []);
return (
<div className="App">
<div className="head">
<input className="search" type="search" placeholder="Search bookmarks"/>
<button className="search-btn"><span className="material-icons-outlined md-36">search</span></button>
<button className="add-btn"><span className="material-icons-outlined md-36">add</span></button>
<button className="settings-btn"><span className="material-icons-outlined md-36">settings</span></button>
</div>
<List data={data} />
</div>
);
}
export default App;
// fetch("/post", {
// // Adding method type
// method: "POST",
// // Adding body or contents to send
// body: JSON.stringify({
// name: "foo",
// title: "bar",
// link: liveinternet.ru,
// tag: Red
// }),
// // Adding headers to the request
// headers: {
// "Content-type": "application/json; charset=UTF-8"
// }
// });