const response = await fetch('http://localhost:5000/', {
method: 'POST',
headers: {
'Content-Type': 'application/text;charset=utf-8'
},
body: "1"
});
const result = await response.json();
alert(result.message);
import { useState } from 'react';
import './App.css';
export const Test = () => {
let [counter, setCounter] = useState(0);
const [value, setValue] = useState('---');
const increment = () => {
counter = setCounter(counter + 1);
};
const decrement = () => {
counter = setCounter(counter - 1);
};
console.log(counter);
return (
<div className="wrapper">
<h1>counter: {counter}</h1>
<h2>{value}</h2>
<input
type="text"
value={value}
onChange={(e) => {
setValue(e.target.value);
}}
/>
<button onClick={increment}>increment</button>
<button onClick={decrement}>decrement</button>
</div>
);
};