vendredi 11 décembre 2020

Quiz App problem- it counts initially from 0 and displays the message of you are passed

 if(this.state.current=== this.state.dataSet.length-1){
    if(this.state.choice.correct===2) { 
      this.setState({IsPassed:true})
    }
    else if(this.state.choice.incorrect===2){ 
      this.setState({IsFailed:true})
  }}else{
    this.setState({current:this.state.current+1})
} 
import React from 'react'

function IsPassed() {
    return (
        <div>
            <h2 className="IsPassed">You are Passed!</h2>
        </div>
    )
}

export default IsPassed;
import React from 'react'

function IsFailed() {
    return (
        <div>
            <h2 className="IsFailed">You are Failed</h2>
        </div>
    )
}

export default IsFailed;

total 3 questions but it displaying 4 entries containing correct and incorrect Whenever i am selecting the correct option first and then incorrect ,so when the third time when i select the correct option, it counts initially from 0 and displays the message of you are passed

Aucun commentaire:

Enregistrer un commentaire