close
Skip to content

Refactor: MoreEdit Component to functional React Component#70482

Merged
Mamaduka merged 5 commits intoWordPress:trunkfrom
coderGtm:refactor/moreedit-component
Jul 2, 2025
Merged

Refactor: MoreEdit Component to functional React Component#70482
Mamaduka merged 5 commits intoWordPress:trunkfrom
coderGtm:refactor/moreedit-component

Conversation

@coderGtm
Copy link
Copy Markdown
Contributor

What?

See #22890

This PR refactors MoreEdit 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

I failed to find usages of this component but I maybe wrong. Hence, skipped the Testing and Screenshots section for now.

@github-actions github-actions bot added the First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository label Jun 20, 2025
@github-actions
Copy link
Copy Markdown

👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @coderGtm! In case you missed it, we'd love to have you join us in our Slack community.

If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information.

@coderGtm coderGtm marked this pull request as ready for review June 20, 2025 08:33
@github-actions
Copy link
Copy Markdown

github-actions bot commented Jun 20, 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: coderGtm <gautam23@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.

@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) [Block] More Affects the More Block - used for displaying the 'Read More' link labels Jun 20, 2025
Copy link
Copy Markdown
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.

Thanks for working on this, @coderGtm!

I left a minor suggestion, but otherwise, refactoring looks good.

Side note: The current focus of #22890 is React web components and not the .native.js files.

}
return (
<HorizontalRule
text={ content }
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
text={ content }
text={ customText || __( 'Read more' ) }

There's no need for the state to hold a static fallback value. We can just inline this.

Copy link
Copy Markdown
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.

Looks good to me. Thanks, @coderGtm!

@coderGtm
Copy link
Copy Markdown
Contributor Author

coderGtm commented Jul 2, 2025

Thanks for reviewing the PR @Mamaduka 🙏🏼

The current focus of #22890 is React web components and not the .native.js files.

I will keep that in mind, thanks for informing!

@Mamaduka Mamaduka merged commit 538ab0a into WordPress:trunk Jul 2, 2025
60 checks passed
@github-actions github-actions bot added this to the Gutenberg 21.2 milestone Jul 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Block] More Affects the More Block - used for displaying the 'Read More' link First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository Mobile App - i.e. Android or iOS Native mobile impl of the block editor. (Note: used in scripts, ping mobile folks to change) [Type] Code Quality Issues or PRs that relate to code quality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants