-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuserAddReview.jsx
More file actions
30 lines (30 loc) · 966 Bytes
/
userAddReview.jsx
File metadata and controls
30 lines (30 loc) · 966 Bytes
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
import React, { Component } from 'react'
import axios from 'axios'
class userAddReview extends React.Component {
constructor(props)
{
super(props);
this.state = {
id: "",
reviewText: ""
}
this.handleClick = this.handleClick.bind(this);
}
handleClick() {
axios.put("http://localhost:3000/api/users//${id}", {
reviewText: this.state.reviewText
})
}
render() {
return (
<div className="userAddReview">
User ID: <input type = "text" id = "id" onChange={e => this.setState({ id: e.target.value })} />
<br></br>
Review: <input type = "text" id = "id" onChange={e => this.setState({ reviewText: e.target.value })} />
<br></br>
<button onClick={this.handleClick}>Done</button>
</div>
)
}
}
export default userAddReview