New to React, trying to display data (inside of a bootstrap modal) from MongoDB to React with an axios ajax request. Postman shows to be correct. React throws "TypeError: this.state.reviews.map is not a function"
, which tells me it is not an array since .map()
is an array method, but Im saving the state as an array. Very confused on how to display data in React, can anyone give an example of how to do this correctly? Searched here, docs, google, still not understanding.
import React from 'react';
import Axios from 'axios';
import Rater from 'react-rater';
import './comment-styles.scss';
export class CommentBox extends React.Component {
constructor(props) {
super(props);
this.state = {
reviews: []
}
this.addReview = this.addReview.bind(this);
};
addReview() {
Axios({
method: 'POST',
url: 'http://localhost:8080/breakfast-tacos/reviews',
headers: {
'Content-Type': 'application/json'
}
}).then(response => {
this.setState({ reviews: [response.data.id] })
}).catch(error => console.log(error))
}
componentDidMount() {
Axios.get('http://localhost:8080/breakfast-tacos/')
.then(reviews => {
this.setState({ reviews: reviews.data })
})
.catch(err => console.log(err))
};
render() {
return (
<div id="commentWrapper">
<div className="commentHeader">
<h5>Leave a Rating!</h5>
<Rater style={{fontSize: '35px'}} />
<button id="submitRatingBtn" type="submit">Submit</button>
<form action="/breakfast-tacos" method="POST">
<textarea className="reviewTextBox" maxLength="250" placeholder="Write a review..." name="reviews"></textarea>
<button id="submitReviewBtn" type="submit" onClick={this.addReview}>Submit</button>
</form>
</div>
<hr />
<div className="reviews">
<span className="user">
<h6>username:</h6>
</span>
<span className="text">
{this.state.reviews.map((review, text) => {
return (
<p key={text}>
{review} /*Where I want to display the data*/
</p>
)
})}
</span>
</div>
<hr />
</div>
)
}
};
advair 230 mcg
http://cialisbob.com/ buy 5mg cialis
Hi friends, how is all, and what you would like to say
about this article, in my view its actually awesome in favor of me. https://hhydroxychloroquine.com/
can you buy clomid online
May I simply just say what a comfort to find
a person that genuinely knows what they are talking about over
the internet. You certainly know how to bring an issue to light and
make it important. More and more people need to look at this and understand this side of your story.
It’s surprising you are not more popular since you certainly possess the gift. http://cleckleyfloors.com/
best place to buy prednisone
https://levitradd.com/ levitra 5 mg
http://himscanada.com/ 100 mg cialis tadalafil
Hi there i am kavin, its my first occasion to commenting anywhere, when i
read this post i thought i could also create comment
due to this good post. https://herreramedical.org/hydroxychloroquine
http://sinrecetaes.com generico de cialis
This is a topic which is near to my heart… Many thanks!
Exactly where are your contact details though? http://herreramedical.org/azithromycin
https://stromectolhumans.com/ ivermectin 12 mg tablets for sale
https://iwermectin.com/ ivermectin
I really like looking through a post that can make people think.
Also, many thanks for allowing for me to comment! http://antiibioticsland.com/Flagyl_ER.htm
https://ivermectineffects.com/ stromectol
https://ivermectinovercounter.com/ buy ivermectin
salbutamol and albuterol
propecia finpecia
health department in pulaski tn. proper way to take blood pressure
can humans take ivermectin paste https://ivermectinhome.com
http://ivermectinus.com/ ivermectin tablets
taking fluoxetine at night
Thank you for the good writeup. It if truth be told used to be
a enjoyment account it. Look complicated to more brought
agreeable from you! By the way, how can we keep up a correspondence? https://buszcentrum.com/deltasone.htm
https://zithrozpack.com/ zpack
when is the last day to sign up for health insurance what does nekb arthritis stand for
ivermectin for cattle https://ivermectinhome.com
what if we pay pastor for health insurance hes has to get himself cure heat exhaustion
bula ivermectina https://ivermectinhome.com
http://albuterolotc.com/ albuterol for sale
ivermectin https://ivermcov.com/# ivermectin tablets dosage
how to avoid health insurance penalty 2017 how to overcome impotence
stromectol indications and usage https://ivermectinhome.com
dapoxetine hidroklorid
icd 10 degenerative arthritis http://ventolinhfaer.com/ inhalers
dapoxetine over the counter
buy ventolin – ventolin price uk ventolin generic brand
blood pressure monitor with bluetooth doctor information in english
buy ivermectin pills https://ivermectinhome.com
cytotec 400 mcg – fastcytoteh where to get misoprostol
doxycycline generic cost – doxycycline cap 50mg can you buy doxycycline online
neurontin 150 mg – neurontin 2018 synthroid 200 mcg coupon
first aid for a stroke http://allergyd.com cetirizine hcl
minnesota department of health individual market stromectol 3mg tablets buy online https://iveramectin.com ivermectin over the counter
I’m truly enjoying the design and layout of your
site. It’s a very easy on the eyes which makes it much more pleasant
for me to come here and visit more often. Did you hire out a designer to create your theme?
Fantastic work! http://hydroxychloroquined.online/
There’s certainly a lot to know about this subject.
I love all the points you’ve made. https://buszcentrum.com/zithromax.htm
health department closes meal mart on main street https://dapoxetineus.com/ buy priligy in canada
viagra mastercard – where can i buy viagra cheap
buying health insurance across state lines http://viwithout.com low cost viagra
cost of cialis with insurance – best tadalafil tablets in india
vardenafil bestellen – penny vardenafil generic vardenafil 40mg
generic viagra 100mg online
prednisone 20mg tablets – prednisone medication prednisone coupon
canadianpharmacy viagra without prescription http://viagrob.com low price viagra
best accutane brand – how to get accutane australia where can you get accutane
sissy impotence training how to buy ivermectin https://iveramectin.com/ ivermectin for humans amazon
buy amoxicillin – buy amoxicilin online amoxil 500
price of medrol – medrol 16 mg cost lyrica over the counter drug
fluoxetine 25 mg
paper writing websites – essayqx.com my family essay writing
viagra 100mg tablet price in india – Buy cheap viagra online us viagra 200mg online
I really like your blog.. very nice colors & theme.
Did you make this website yourself or did you hire someone to
do it for you? Plz respond as I’m looking to construct my own blog and
would like to find out where u got this from. many thanks http://herreramedical.org/tadalafil
order stromectol online – ivermectin virus stromectol for humans
prednisone 5443 – buy 40 mg prednisone generic prednisone 40mg
ventolin for sale – site ventolin 90
clomid twins
doxycycline 75 mg coupon – doxycycline cheapest uk prednisolone 20 mg
where to buy lasix furosemide
http://albuterolotc.com – ?ventolin uk price
stromectol online – ivermectin tablets for sale walmart generic name for ivermectin
advair generic europe
You need to be a part of a contest for one of the best
websites on the web. I’m going to highly recommend this web site! http://ciaalis2u.com/
https://stromectolo.com – ivermectin for humans
ivermektin 3 mg tablet dozajД± http://ivermectin1.com/ stromectol
z pack for ear infection in adults https://azithrozpack.com buy antibiotics
ivermectin for people – ivermectin 3 mg dose stromectol nz
sildenafil for women – sildenafil online usa sildenafil canada
canadian pharmacy tadalafil – buy tadalafil pills tadalafil 10 mg
ivermectin 500ml – ivermectin pills canada stromectol price us
buy sildenafil from canada cheap – Cialis mail order usa online pharmacy no rx
http://ivrmectin.com – ohio judge ivermectin ruling
prescription strength zyrtec 20 mg – https://allergyd.com
propecia 5 mgs
vardenafil 10mg – trusted online pharmacy reviews best ed drugs
benefits of plaquenil – buying prednisone online can i buy prednisone over the counter in usa
orlistat bnf – alli vs xenical generic xenical australia
generic tadalafil pills
tadalafil 100mg online
sildenafil over the counter us – real viagra buy cheap generic viagra online
reputable indian online pharmacy http://stromectolforte.com/ ivermectin over the counter stromectol uk
canadian cialis 10mg – canadian pharmacy meds cialis for daily use 5mg
how to get prednisone online – prednisone india where to buy prednisone without a prescription
zithromax dosage children
ivermectin 3 mg tablet dosage http://ivermecton.com/ п»їohio judge ivermectin
albuterol sulfate hfa en espaГ±ol
stromectol 2mg – generic ivermectin online ivermectin 3
cialis or levitra which is better https://levitraoff.com levitra dissolvable
711 viagra pills – site viagra 88
cialis 5mg online uk – cialis coupon tadalafil online pharmacy india
stromectol over the counter http://ivermecton.com/ stromectol canada
cialis 20mg price in canada – Canadian generic cialis tadalafil tablets price in india
ivermectin 2mg – stromectol virus ivermectin 3mg
best online casino usa – casino slot hollywood casino
viagra with dapoxetine uk
high blood pressure medicine http://vardenafilz.com – levitra discount program
tadalafil 5mg coupon
200 mg generic viagra – ciasilap viagra cheap online uk
What’s up, I would like to subscribe for this website to take most
recent updates, therefore where can i do it please help. http://harmonyhomesltd.com/Ivermectinum-precautions.html
ivermectin 3mg pill http://ivermectinhum.com/ stromectol
ivermectina online – stromectol lotion cost ivermectin 400 mg brands
http://kamagradr.com – low cost kamagra
can you order viagra for woman
60 mg prednisone – prednisone 20mg without prescription prednisone 50 mg tablet price
real viagra canada https://www.viagwdp.com/# erectile dysfunction medicine viagra 150 mg prices
cost of viagra 100mg in australia
accutane pills – accutanplus.com accutane price nz
http://www.fildenahim.com – fildena online sales
purchase plaquenil online cheap – plaquenil online order valtrex 500mg pill
buy sildalis pill – purchase fluconazole pill glucophage ca
fluconazol kruidvat
buy ampicillin 500mg sale – cipro 1000mg price plaquenil 400mg pills
hydroxychloroquine over the counter – plaquenil pills buy hydroxychloroquine 200mg online
omnicef vs amoxicillin
can i use dulera with albuterol
https://cialiswbtc.com/
what is tadalafil buy cialis
cialis without a prescription buy cialis pills
buy generic cialis online with mastercard where to buy generic cialis online safely
generic tadalafil from uk where to order tadalafil tablets
cheapest tadalafil cost tadalafil side effects
where to buy tadalafil on line cost of cialis
canada generic tadalafil tadalafil cost in canada
tadalafil online with out prescription tadalafil generic where to buy
https://cialisicp.com/ where to get tadalafil
tadalafil cost in canada tadalafil blood pressure
cialis without a prescription cheapest tadalafil cost
stromectol 3 mg tablets
stromectol otc buy stromectol online
ivermectin tablets for sale canada ivermectin tablets for humans
ivermectin 6 mg generic stromectol 6mg