diff --git a/client/src/components/Binary/Choices_appear.js b/client/src/components/Binary/Choices_appear.js index 761bf50..c4269ef 100644 --- a/client/src/components/Binary/Choices_appear.js +++ b/client/src/components/Binary/Choices_appear.js @@ -1,9 +1,37 @@ import React, { Component } from "react"; import { browserHistory } from "react-router"; +import axios from "axios"; class ChoicesAppear extends Component { + constructor(props) { + super(props); + this.state = { + choices: [] + }; + } + + componentDidMount() { + const id = this.props.match.params.trialId; + axios + .get(`/choices/${id}`) + .then(res => { + this.setState({ choices: res.data }); + }) + .catch(err => { + console.log(err); + }); + } render() { - return
choices... you have got to pick!
; + return ( +
+ {this.state.choices.map((data, index) => ( +
+

{data.Choices_left}

+

{data.Choices_right}

+
+ ))} +
+ ); } } diff --git a/client/src/components/Binary/Trial_form.js b/client/src/components/Binary/Trial_form.js index 9832cbb..c9cdab1 100644 --- a/client/src/components/Binary/Trial_form.js +++ b/client/src/components/Binary/Trial_form.js @@ -12,7 +12,6 @@ class Trial_form extends Component { handleChange = event => { const target = event.target; this.setState({ trialId: randomId(), [target.name]: target.value }); - console.log("state: ", this.state); }; handleSubmit = event => {