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

Refactor ToggleControl to use functional component #23116

Merged
merged 1 commit into from
Jun 15, 2020

Conversation

sc81
Copy link
Contributor

@sc81 sc81 commented Jun 12, 2020

No description provided.

Copy link
Contributor

@youknowriad youknowriad left a comment

Choose a reason for hiding this comment

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

Thanks, this looks good.

Left a minor comment.

onChange,
} ) {
function onChangeToggle( event ) {
onChange( event.target.checked );
Copy link
Contributor

Choose a reason for hiding this comment

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

The previous onChange handler was checking whether the onChange prop was set or not. Should we do the same?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The onChange prop is required, without this prop the component will not be usable. When prop is undefined the JS engine will report an error, so the programmer will know what he did wrong.

Copy link
Contributor

Choose a reason for hiding this comment

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

Makes sense and it's also documented as such in the README.

@youknowriad youknowriad merged commit 9b8132d into WordPress:master Jun 15, 2020
@github-actions
Copy link

Congratulations on your first merged pull request, @sc81! We'd like to credit you for your contribution in the post announcing the next WordPress release, but we can't find a WordPress.org profile associated with your GitHub account. When you have a moment, visit the following URL and click "link your GitHub account" under "GitHub Username" to link your accounts:

https://profiles.wordpress.org/me/profile/edit/

And if you don't have a WordPress.org account, you can create one on this page:

https://login.wordpress.org/register

Kudos!

@github-actions github-actions bot added the First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository label Jun 15, 2020
@github-actions github-actions bot added this to the Gutenberg 8.4 milestone Jun 15, 2020
@sc81 sc81 deleted the refactor/toggle-control branch June 17, 2020 14:03
This was referenced Jun 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] UI Components Impacts or related to the UI component system First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository [Package] Components /packages/components [Type] Code Quality Issues or PRs that relate to code quality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants