-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Class to function #77
base: master
Are you sure you want to change the base?
Conversation
… state to update properly once clicked. After you find two that don't match it crashes. Will look into more. Once I get it to functional component will be able to help with other code as I feel more comfortable with functional compoenents rather than classes
…state to remove other items. Now start new game is having issues.
…k my formatting is off for the highscorelist
…e issue. The count for clicks and revealed cards seems to be one off. Will work more on it
temporaryValue, | ||
randomIndex; | ||
|
||
while (0 !== currentIndex) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Condition can only be like while (currentIndex)
temporaryValue = cards[currentIndex]; | ||
cards[currentIndex] = cards[randomIndex]; | ||
cards[randomIndex] = temporaryValue; | ||
console.log({state}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can remove the logs.
cardDeck[currentIndex] = cardDeck[randomIndex]; | ||
cardDeck[randomIndex] = temporaryValue; | ||
} | ||
console.log(`cards to be rerendered are ${cardDeck}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can remove the logs.
console.log({updateAccuracy}); | ||
console.log(`accuracy is ${accuracy}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can remove the logs.
// ...state, | ||
// accuracy : fakeAccuracy | ||
// }); | ||
console.log(`in accuracy`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can remove the logs.
console.log(`userAttempts are ${userAttempts} num possible is ${numPossibleCorrect}`); | ||
console.log({updateAccuracyRate}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can remove the logs.
|
||
//adds how many active cards flipped there are | ||
newRevealStates.forEach(function(el) { | ||
if (el === true) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can just keep the condition to be if (el)
|
||
newRevealStates[index] = true; | ||
|
||
console.log({newRevealStates}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can remove the logs.
this.hideCards(() => { | ||
this.updateAccuracy(); | ||
hideCards(() => { | ||
console.log(`where I want to be`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can remove the logs.
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
I am changing the code from class to a functional component with state
Issue Number: N/A
What is the new behavior?
Same behavior
Does this PR introduce a breaking change?
Other information