-
Notifications
You must be signed in to change notification settings - Fork 7
Expose a minimal, shared reconciler interface to encourage component reuse #35
Description
While working on #34 I updated the DOM reconciler example to have its primitives look more like the ones in revery:
revery is already exposing CSS-like styles, and colors.
This made me think that, if there was a common interface that exposed the type for a minimal, shared set of primitives, it could be possible to have 100% reusable components across different reconcilers, as long as those primitives remain the same and the components themselves don't use environment-dependent APIs. Another upside would be the familiarity with these primitives so moving from one platform to another would have less friction.
The downsides of having this common interface would be that specific environments could put back-pressure onto these primitives, to promote new controversial primitives to get included, or some attributes / types are modified to satisfy one specific reconciler, but that might be unavailable in other platforms.
In any case, this "universal interface" would be optional, so reconcilers authors could always decide if they want their reconciler to matche this interface or not.
I'm also not sure if the interface should live in reason-reactify, or better in revery. I think the "lower" it is defined on the dependency chain, the more chances to increase the reuse of platform-agnostic components.
References:
react-primitives: . 10 primitives reusable across React applications.react-native-web: much more expansive than React Primitives- "Universal Rendering":
react-sketchappdocs styled-components/primitives: And the announcement blog post.emotion-primitivesglamorous-primitives