LocChat/client/app.jsx

40 lines
823 B
React
Raw Normal View History

2021-11-16 21:14:46 -05:00
import { useState } from 'react';
import { setConstantValue } from 'typescript';
const App = () => {
const [email, setEmail] = useState('');
const [password, setPassword] = useState('');
const submit = () => {
fetch('/sign_in', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ email, password }),
});
};
return (
<>
<div>
<input
type="email"
value={email}
onChange={(e) => setEmail(e.target.value)}
/>
</div>
<div>
<input
type="password"
value={password}
onChange={(e) => setPassword(e.target.value)}
/>
</div>
<button type="button" onClick={submit}>Login</button>
</>
);
};
export default App;