votingApp
votingApp copied to clipboard
find asynchronous receiveprops solution for displaying a vote (conditional rendering)
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);
}