votingApp icon indicating copy to clipboard operation
votingApp copied to clipboard

find asynchronous receiveprops solution for displaying a vote (conditional rendering)

Open Createdd opened this issue 7 years ago • 0 comments

currently @singlePollCon:

  componentWillReceiveProps(nextProps) {
    setTimeout(() => {
      axios
				.get(`/api/polls/${this.props.match.params.id}`)
				.then((res) => {
  this.setState({ poll: res.data, fetched: true });
})
				.catch((err) => {
  console.log(err);
});
    }, 100);
  }

Createdd avatar Aug 01 '17 16:08 Createdd