Skip to content

Refactor: URLInput component to functional react component #70385

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

Open
wants to merge 9 commits into
base: trunk
Choose a base branch
from

Conversation

yashjawale
Copy link
Contributor

What?

See #22890

This PR refactors URLInput 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
  • The withSelect Higher-Order Component (HOC) is replaced by the useSelect hook from @wordpress/data
  • Rest of component logic remains the same
  • Existing comments are preserved

Testing Instructions

  • To test this component try converting any text to link, the URL input box uses this component
  • The suggestions are also provided by the same 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!

@Mamaduka Mamaduka added [Type] Code Quality Issues or PRs that relate to code quality [Package] Block editor /packages/block-editor labels Jun 11, 2025
@yashjawale yashjawale marked this pull request as ready for review June 13, 2025 10:52
@yashjawale yashjawale requested a review from ellatrix as a code owner June 13, 2025 10:52
Copy link

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 <[email protected]>

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

@yashjawale
Copy link
Contributor Author

CI issues have been resolved for this PR & it is ready for review

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