Skip to content

Refactor: Convert native Dropdown to functional component #70452

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 2 commits into
base: trunk
Choose a base branch
from

Conversation

BugReportOnWeb
Copy link
Contributor

@BugReportOnWeb BugReportOnWeb commented Jun 17, 2025

What?

Related #22890

This PR converts the native Dropdown component from a class based implementation to a functional component using React hooks.

Why?

To align with the modern React practices and improve consistency across the codebase by using functional component with React hooks. This also makes the component easier to maintain and test over time.

How?

  • Replaced class based lifecycle methods with useEffect
  • Used useState, useCallback and useMemo for state and memoization.
  • Preserved all previous logic and behavior.

@BugReportOnWeb BugReportOnWeb marked this pull request as ready for review June 18, 2025 09:44
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: BugReportOnWeb <[email protected]>

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

@t-hamano t-hamano added [Type] Code Quality Issues or PRs that relate to code quality Mobile App - i.e. Android or iOS Native mobile impl of the block editor. (Note: used in scripts, ping mobile folks to change) [Package] Components /packages/components labels Jun 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Mobile App - i.e. Android or iOS Native mobile impl of the block editor. (Note: used in scripts, ping mobile folks to change) [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.

2 participants