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

Reusability in functional components via React.memo instead of class component #1089

Merged
merged 1 commit into from
Jan 28, 2024

Conversation

rpiaggio
Copy link
Collaborator

shouldComponentUpdate hook and renderWithReuse use an embedded class component to achieve reusability.

This PR changes the approach to the recommended use of React.memo for this purpose. This avoids having to mix functional and class components.

Furthermore, I'm having trouble making class components work with React 18. This unlocks the use of React 18 for apps with purely functional components.

@rpiaggio rpiaggio requested review from japgolly and cquiroz January 27, 2024 19:09
@cquiroz
Copy link
Collaborator

cquiroz commented Jan 28, 2024

Would it make sense to make a partial release for React 18 with only functional components support?

Copy link
Collaborator

@cquiroz cquiroz left a comment

Choose a reason for hiding this comment

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

LGTM

@rpiaggio
Copy link
Collaborator Author

Would it make sense to make a partial release for React 18 with only functional components support?

I think so. That's what I'm going for.

@rpiaggio rpiaggio merged commit 3c0f6fa into master Jan 28, 2024
2 checks passed
@cquiroz cquiroz deleted the usememo-reuse branch January 28, 2024 18:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants