Skip to content
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

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

Conversation

saykaren
Copy link

PR Checklist

Please check if your PR fulfills the following requirements:

  • [x ] The commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

[ ] Bugfix
[ ] Feature
[ x] Code style update (formatting, local variables) - Changes class to a functional component
[ ] Refactoring (no functional changes, no api changes)
[ ] Documentation content changes
[ ] Other... Please describe:

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?

[ ] Yes
[ x] No

Other information

memoryGame_10 14 2019

Karen Garcia added 7 commits October 3, 2019 15:48
… 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) {

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});

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}`);

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.

Comment on lines +203 to +204
console.log({updateAccuracy});
console.log(`accuracy is ${accuracy}`);

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`);

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.

Comment on lines +174 to +175
console.log(`userAttempts are ${userAttempts} num possible is ${numPossibleCorrect}`);
console.log({updateAccuracyRate});

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) {

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});

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`);

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants