-
Notifications
You must be signed in to change notification settings - Fork 4k
Modernize countdown component #9734
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
Conversation
| public static defaultProps: Partial<Props> = { | ||
| endCallback: () => {}, | ||
| } | ||
| const Countdown: React.FC<Props> = ({ countdown, endCallback = () => {} }) => { |
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.
nit: instead of the defining a default function that does not do anything, we could just have it undefined and check for it here
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.
I made it a required prop again which should solve this as well.
| const { countdown } = this.state | ||
| const { endCallback } = this.props | ||
| const newCountdown = countdown - 1 | ||
| const onAnimationEnd = (): void => { |
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.
Do you know why onAnimationEnd was an async function before?
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.
Nope, not sure. But I changed it back to async.
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.
I have just had a look at the MDN web docs and it does not mention asynchronicity: https://developer.mozilla.org/en-US/docs/Web/API/Element/animationend_event
So in this case we should probably remove it to avoid confusion
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.
Oki, I removed it again 👍
## Describe your changes Migrate the countdown component from class-based to functional. ## Testing Plan - No logical changes, no tests required. --- **Contribution License Agreement** By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license. --------- Co-authored-by: Lukas Masuch <[email protected]>
Describe your changes
Migrate the countdown component from class-based to functional.
Testing Plan
Contribution License Agreement
By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.