Modernize @sitecore-content-sdk/react to React 19+ Best Practices (HOCs → Hooks, Class → Functional Components) #281
robertsoniv
started this conversation in
Ideas
Replies: 2 comments 3 replies
-
Impact Summary for
|
Beta Was this translation helpful? Give feedback.
0 replies
-
|
@robertsoniv Thank you for the detailed input!
Other suggestions are valid and would make code a practices cleaner in Content SDK |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Is your suggestion related to a problem? Please describe.
The @sitecore-content-sdk/react package uses outdated React patterns that don't align with React 19+ best practices:
Current Issues:
These patterns work but don't leverage React 19 optimizations, make code less composable, and create a steeper learning curve for developers familiar with modern React patterns.
Describe the solution you'd like
Modernize the package through a phased, backwards-compatible approach:
Phase 1: Create Hook Infrastructure
Phase 2: Refactor HOCs to Use Hooks
Phase 3: Convert Class Components to Functional
Phase 4: Fix React Patterns
Phase 5: Testing & Documentation
Key Benefits:
Is there a way to achieve this functionality with exisiting tools?
Yes, the existing HOCs continue to work. The modernization adds hooks as the preferred pattern while keeping HOCs functional. Consumers can:
The hooks provide the same functionality with better composability. For example:
withEditorChromes(Component)→useEditorChromes()inside componentwithPlaceholder(...)(Component)→const placeholderData = usePlaceholder(...)withSitecore()(Component)→const { page, api } = useSitecore()(already exists)Additional information
Implementation Details:
Files to Create:
Files to Refactor:
Versioning Strategy:
Success Criteria:
Beta Was this translation helpful? Give feedback.
All reactions