[POC] @xstate/component #1524
Unanswered
ChrisShank
asked this question in
Ideas
Replies: 1 comment
-
cool idea 😎 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi everyone! I have been exploring a proof of concept that I hope can eventually become
@xstate/component
. I'm exploring what it would look like to usexstate
as the core reactivity/state management system of a component rather than integratingxstate
into other component libraries. Its sort of unmaintainable to continue creating separate packages that integratesxstate
into component libraries (e.g.@xstate/react
@xstate/vue
) and also does not help out smaller libraries either. Its also interesting to think about how makingxstate
the primitive state management system would change how we think about creating components.So what if
@xstate/component
would let someone define framework-agnostic components using xstate so they could just import that component into their application? Under the hood, we would use Web Components to stay framework agnostic. Now even ifxstate
is the reactivity system and Web components provide allow us to hook into the component's lifecycle we still need a way to declaratively render our component. I think that tagged template literal libraries such aslit-html
,uhtml
, ect. could solution because they have the flexibility of JSX with the static analysis possible with template. We can even design this package to be agnostic to the the rendering library similar to howhtm
lets you bind your own render function.I'm looking for any feedback/discussion to further develop this idea and see if it is something that developers would want to use!
Some other thoughts:
xstate
can be used to accomplish this.xstate
and@xstate/fsm
(for a smaller bundle).Beta Was this translation helpful? Give feedback.
All reactions