Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import React from 'react'
import {useState} from 'react'
import axios from 'axios'
const SignUp = () => {
const[username,setUsername] = useState("")
const[password,setPassword] = useState("")
const[email,setEmail] = useState("")
const Signup = () => {
console.log({email,username,password})
const config = {
headers: {
"Content-type": "application/json",
},
};
axios.post("http://localhost:5000/register", {email,username,password},config)
.then((res) => {
console.log(res.data)
}).catch((err) => console.log(err))
}
return (
<div>
<input type='text' placeholder='Email' onChange={(e) => setEmail(e.target.value)}/>
<input type='text' placeholder='Username' onChange={(e) => setUsername(e.target.value)}/>
<input type='text' placeholder='Password' onChange={(e) => setPassword(e.target.value)}/>
<button onClick={Signup}>Sign up</button>
</div>
)
}
export default SignUp