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

add task solution #1981

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

OlehYavoriv
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 App component! 🎉 The functionality is spot on, and you've met all the core requirements of the task. There are a couple of minor improvements you could make: consider importing KeyboardEvent from 'react' to align with React's synthetic events, and type the props parameter in the constructor as props: {} or props: Record<string, never>. These tweaks will enhance your code's clarity and maintainability. Keep up the excellent work! 🚀

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

export class App extends React.Component {
state = { keypressed: '' };

constructor(props: {}) {

Choose a reason for hiding this comment

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

The props parameter in the constructor should be typed properly. Since it's an empty object, you can use props: {} or props: Record<string, never> to indicate that no props are expected.

this.handleKeyup = this.handleKeyup.bind(this);
}

handleKeyup(event: KeyboardEvent) {

Choose a reason for hiding this comment

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

The KeyboardEvent type should be imported from 'react' instead of using the default DOM event type. Change KeyboardEvent to React.KeyboardEvent to ensure compatibility with React's synthetic events.

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