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

some commit message #1966

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

some commit message #1966

wants to merge 4 commits into from

Conversation

tuhusova
Copy link

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job on implementing the React component! 🎉 Your code meets all the task requirements and constraints, and you've handled event listeners effectively. The only minor point to consider is the conditional setState in your keyUpHandler. If you want the state to update even when the same key is pressed consecutively, you might want to adjust this logic. Keep up the excellent work! 😊

✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨

src/App.tsx Outdated
Comment on lines 22 to 23
this.setState(prevState =>
prevState.pressedKey !== event.key ? { pressedKey: event.key } : null

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The setState method is conditionally updating the state only if the pressed key is different from the previous one. If the same key is pressed consecutively, the state will not update, and the console will still log the key. If this is not the intended behavior, consider removing the condition to always update the state with the pressed key.

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