Reusable component design tip: Extend the native root element's type, and...


Reusable component design tip:

Extend the native root element's type, and pass native props to the root element via rest syntax.

Benefits:
1. Your type declaration doesn't need specify all valid props.

2. Users can still pass all valid HTML attributes to the root element.

View original on X