Skip to content

Refactor: URLInputButton component to functional react component #70384

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

yashjawale
Copy link
Contributor

What?

See #22890

This PR refactors URLInputButton component from class based component syntax to newer functional component syntax.

Why?

Class based components are no longer the recommended approach & instead functional syntax with hooks is more recommended
The code becomes more readable & easier to make changes to

How?

  • React hooks are used for component lifecycle methods
  • Rest of component logic remains the same

Testing Instructions

  • To test this component try converting any text to link
  • The toolbar button for adding link is provided by this component
  • The component should behave same as before

Screenshots or screencast

image

I'm new to gutenberg contributions, feel free to provide suggestions for improvement & pointing out mistakes
Thanks!

@yashjawale yashjawale requested a review from ellatrix as a code owner June 11, 2025 08:01
Copy link

github-actions bot commented Jun 11, 2025

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: yashjawale <yashjawale@git.wordpress.org>
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@Mamaduka Mamaduka added [Type] Code Quality Issues or PRs that relate to code quality [Package] Block editor /packages/block-editor labels Jun 11, 2025
Copy link
Member

@Mamaduka Mamaduka left a comment

Choose a reason for hiding this comment

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

Thank you, @yashjawale!

@Mamaduka Mamaduka merged commit 4b9e53c into WordPress:trunk Jun 12, 2025
65 of 66 checks passed
@github-actions github-actions bot added this to the Gutenberg 21.1 milestone Jun 12, 2025
chriszarate pushed a commit to chriszarate/gutenberg that referenced this pull request Jul 1, 2025
…ordPress#70384)

Co-authored-by: yashjawale <yashjawale@git.wordpress.org>
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] Block editor /packages/block-editor [Type] Code Quality Issues or PRs that relate to code quality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants