I keep boolean flag named validationPassed in a state which I use in if statement. If it’s true, I allow axios request to happen. Before that if statement I call doValidation() which has a lot of if statements. If one of them fail, I setState of that boolean flag to false. In setState() I put console.log callback and it seems boolean flag is successfuly set to false but not immediately because if(this.state.validationPassed) passes when it shouldn’t. I’m aware that React state is asynchronous. Tried to use prevState argument to toggle boolean’s value but it didn’t work. How do I make this work? Maybe there’s another way to do validation without boolean flags?
this.state = {
validationPassed: true
}
}
this.doValidation(usernameFromUser, passwordFromUser)
if(this.state.validationPassed){
// axios call
}
}
doValidation = (username, password) => {
if(username.trim().length === 0){
this.setState( {
validationPassed: false }, () => {console.log(this.state.validationPassed)});
}
if(password.trim().length === 0){
this.setState( {
validationPassed: false }, () => {console.log(this.state.validationPassed)});
}
if(username.trim().length < 8){
this.setState( {
validationPassed: false }, () => {console.log(this.state.validationPassed)});
}
if(username.trim().length > 20){
this.setState( {
validationPassed: false }, () => {console.log(this.state.validationPassed)});
}
if(password.trim().length < 8){
this.setState( {
validationPassed: false }, () => {console.log(this.state.validationPassed)});
}
if(new RegExp("^(?!(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.{8,}))").test(password)){
this.setState( {
validationPassed: false }, () => {console.log(this.state.validationPassed)});
}
}
modafinil and caffeine – provigil settlement provigil schedule
generic of accutane – buy accutane online without prescription cheap accutane uk
amoxil 500 mg generic name – generic amoxicillin cost amoxicillin for humans for sale
buy viagra cialis vardenafil online – buy cialis viagra vardenafil generic vardenafil reviews
ivermectin for humans – stromectol online pharmacy price of stromectol
buy tadalafil 100mg – tadalafil cost in canada cialis generic from canada
ivermectin 3mg tabs – ivermectin 0.5% ivermectin 0.5 lotion india
accutane by mail – accutane 10mg price for generic accutane
lyrica cost in canada – canadian pharmacy checker cheap canadian pharmacy online
generic amoxil 250mg – site buy amoxicillin 500 mg from canada
female viagra for sale australia – can you buy viagra over the counter canada best online viagra
tadalafil soft tablets – price for cialis in canada generic cialis sale
ivermectin 3 mg tablet dosage – generic ivermectin ivermectin buy australia
prednisone 10mg online – prednisone australia deltasone 20 mg tablet price
modafinil online – modafinil adhd provigil 100mg
zithromax cost – zithromax liquid order azithromycin 500mg
lasix 40mg – where can i buy otc furosemide 12.5mg furosemide
buy clomiphene – purchase clomiphene order clomid online
viagra 150mg – where can i buy viagra pills online viagra 100 tablet
cialis 10mg tablet – real cialis from canada how much is daily cialis
stromectol 2mg online – buy stromectol ivermectina 6 mg
empire casino online – gambling casino online online casino gambling
erection pills online – erectile dysfunction cure male ed pills
how much is prednisone 5mg – prednisone 20mg no prescription 40 mg prednisone pill
buy viagra medicine online india – sildenafil 100mg india buy sildenafil 100mg online comparison
how to get cialis prescription online – Brand cialis for sale canadian tadalafil online
buy ivermectin uk – stromectol over counter ivermectin 500mg
pills for ed – edstronglp.com how to cure ed
ventolin 90 – can i buy ventolin over the counter in usa ventolin tablet price
cytotec 200mcg tab – buy cytotec online usa cytotec buy
how can i get doxycycline over the counter – doxycyclinegn.com doxycycline for sale over the counter
drug neurontin – neurontin brand name 800mg levothyroxine 62.5 mcg
how to buy viagra cheap – viagra pharmacy australia
generic cialis in united states – cialis online purchase canada
vardenafil coupon – generic cialis viagra vardenafil online generic vardenafil canada
buy prednisone 10mg – prednisone 20mg online pharmacy prednisone medication
roaccutane – accutans.com accutane 30 mg price
antibiotics without a doctor’s prescription – amoxicillin 500 mg for sale in canada today buy amoxicillin online
stromectol usa
solu methylprednisolone – lyrica 70 mg lyrica price in mexico
lasix 40 mg tablet lasix 500 mg online nek nox
essay for you – term paper for sale buy nothing day essay
lasix 500 mg tablet price frusemide 20mg nek nox
viagra pharmacy usa – Viagra overnight delivery where to order generic viagra
lasix 40 mg tablet price furosemide 10 mg nek nox
lasix tablet 40 mg price buy lasix without a prescription nek nox
stromectol oral – oral stromectol cost ivermectin tablet
prednisone 2.5 mg – 40 mg prednisone pill prednisone 25
albuterol nebulizer – generic ventolin albuterol without prescription
stromectol otc ivermectin 250ml
purchase doxycycline 100mg – doxycycline online paypal prednisolone 3 mg
ivermectin buy online stromectol usa
stromectol 3 mg ivermectin buy online
cheap stromectol – ivermectin india stromectol tablets for sale
ivermectin 9mg – stromectol for sale ivermectin 12 mg
sildenafil reviews – sildenafil 20 canadian pharmacy sildenafil
clomid cijena nek nox
tadalafil buy – tadalafil generic date generic tadalafil online
clomid over the counter walmart nek nox
accutane for acne – accutane pills price in india accutane 30 mg cost
cost stromectol – ivermectin cost australia cost of ivermectin lotion
amoxicillin 500 mg cost
sildenafil 130 mg – Real cialis without prescription order cialis without prescription
buy stromectol tablets buy stromectol online
propecia europe online
vardenafil 10 mg – levitra dosage ed solutions
plaquenil tablets 200mg – cost of prednisone can you buy prednisone over the counter in canada
buy deltasone
orlistat myproana – orlistat cancer risk xenical 120mg capsules
order cialis online uk
tadalafil generic online
how much is viagra in south africa – us pharmacy viagra viagra price in canada
buying cialis in canada – cialis black generic 10mg cialis
how to get toddler to take zithromax
generic prednisone 20mg – prednisone 20 mg tablet where to get prednisone
order ventolin from australia
zithromax pack
sildenafil tablets online – realsilpll.com where to buy viagra online canada