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

Migrate Button component from class to function style #1020

Conversation

Anass-Daoudi
Copy link
Contributor

Issue: This is the linked issue #730

In this PR I migrate Button component from class to function style using React hooks.

Friendly request: could you please label this PR with the label hacktoberfest-accepted when approved so it counts into the hacktoberfest 2021 challenge. Thank you in advance : )

{props.children}
</a>
) : (
<button type={props.type} className={className} onClick={click}>
Copy link
Member

Choose a reason for hiding this comment

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

there's one scenario where a button won't have an href nor the onClick props. On the original version I had a third template without the onClick props.

I think we'd either need to go with that or change the click function to do absolutely nothing if props.onClick is undefined.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch 👍
I think having a third check is cleaner, I fix that asap.

@Anass-Daoudi Anass-Daoudi requested a review from goenning October 27, 2021 20:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants