IssueRaiser

RFC: Plan for custom element attributes/properties in React 19

This is meant to address #7249. The doc outlines the pros and cons of various approaches React could use to handle attributes and properties on custom elements. # TOC/Summary - Background - Proposals * Option 1: Only set properties + Pros - Easy to understand/implement - Avoids conflict with future global attributes - Takes advantage of custom element "upgrade" - Custom elements treated like any other React component + Cons - Possibly a breaking change - Need ref to set attribute - Not clear how server-side rendering would work * Option 2: Properties-if-available + Pros - Non-breaking change + Cons - Developers need to understand the heuristic - Falling back to attributes may conflict with future globals * Option 3: Differentiate properties with a sigil + Pros - Non-breaking change that developers can opt-in to - Similar to how other libraries handle attributes/properties - The system is explicit + Cons - It’s new syntax - Not clear how server-side rendering would work * Option 4: Add an attributes object + Pros - The system is explicit - Extending syntax may also solve issues with event handling + Cons - It’s new syntax - It may be a breaking change - It may be a larger change than any of the previous proposals * Option 5: An API for consuming custom elements + Pros - The system is explicit - Non-b

Posted by robdodson on Oct 24, 2017, 5:28 AM

Tags

Related issues

Raise real-world problems, find people facing the same issue, and discuss solutions.4,500 issues0 comments

github (Sysadmin)

RFC: Plan for custom element attributes/properties in React 19

robdodsonOct 24, 2017, 5:28 AM

This is meant to address #7249. The doc outlines the pros and cons of various approaches React could use to handle attributes and properties on custom elements. # TOC/Summary - Background - Proposals * Option 1: Only set properties + Pros - Easy to understand/implement - Avoids conflict with future global attributes - Takes advantage of custom element "upgrade" - Custom elements treated like any other React component + Cons - Possibly a breaking change - Need ref to set attribute - Not clear how server-side rendering would work * Option 2: Properties-if-available + Pros - Non-breaking change + Cons - Developers need to understand the heuristic - Falling back to attributes may conflict with future globals * Option 3: Differentiate properties with a sigil + Pros - Non-breaking change that developers can opt-in to - Similar to how other libraries handle attributes/properties - The system is explicit + Cons - It’s new syntax - Not clear how server-side rendering would work * Option 4: Add an attributes object + Pros - The system is explicit - Extending syntax may also solve issues with event handling + Cons - It’s new syntax - It may be a breaking change - It may be a larger change than any of the previous proposals * Option 5: An API for consuming custom elements + Pros - The system is explicit - Non-b

Comments (0)

No comments yet. Start the discussion.

Comment on this issue