File tree 2 files changed +29
-2
lines changed
client/src/components/Binary
2 files changed +29
-2
lines changed Original file line number Diff line number Diff line change 1
1
import React , { Component } from "react" ;
2
2
import { browserHistory } from "react-router" ;
3
+ import axios from "axios" ;
3
4
4
5
class ChoicesAppear extends Component {
6
+ constructor ( props ) {
7
+ super ( props ) ;
8
+ this . state = {
9
+ choices : [ ]
10
+ } ;
11
+ }
12
+
13
+ componentDidMount ( ) {
14
+ const id = this . props . match . params . trialId ;
15
+ axios
16
+ . get ( `/choices/${ id } ` )
17
+ . then ( res => {
18
+ this . setState ( { choices : res . data } ) ;
19
+ } )
20
+ . catch ( err => {
21
+ console . log ( err ) ;
22
+ } ) ;
23
+ }
5
24
render ( ) {
6
- return < div > choices... you have got to pick!</ div > ;
25
+ return (
26
+ < div >
27
+ { this . state . choices . map ( ( data , index ) => (
28
+ < div key = { index } >
29
+ < p > { data . Choices_left } </ p >
30
+ < p > { data . Choices_right } </ p >
31
+ </ div >
32
+ ) ) }
33
+ </ div >
34
+ ) ;
7
35
}
8
36
}
9
37
Original file line number Diff line number Diff line change @@ -12,7 +12,6 @@ class Trial_form extends Component {
12
12
handleChange = event => {
13
13
const target = event . target ;
14
14
this . setState ( { trialId : randomId ( ) , [ target . name ] : target . value } ) ;
15
- console . log ( "state: " , this . state ) ;
16
15
} ;
17
16
18
17
handleSubmit = event => {
You can’t perform that action at this time.
0 commit comments