gardencmp / jazz

A new way to build apps with distributed state.
https://jazz.tools
MIT License
342 stars 15 forks source link

non-React examples? #192

Open rozek opened 2 months ago

rozek commented 2 months ago

Are there some examples for using jazz in a browser environment without React?

I played around a bit, but did not succeed at all - I could not even build jazz itself.

Thus, some more examples (and a more complete documentation) would be helpful...

aeplay commented 2 months ago

Hey, a whole new website & docs is coming up in the next days. You should be able to use the jazz-browser package then and I'll add a minimal example.

Are you planning to use a bundler, or which kind of setup do you have in mind?

rozek commented 2 months ago

I often do not bundle my web apps themselves but prefer interactive live "no-build environments" for which I sometimes bundle the required modules (using "vite").

The apps themselves use "htm" and "preact" (but "preact" component classes rather than functional components) I already looked at https://github.com/nichoth/jazz-preact but could not easily extract the underlying jazz mechanisms from the code (jazz-preact uses "hooks" for preact functions rather than classes)

aeplay commented 2 months ago

It would be really fun to see how well jazz works in a non-bundled environment. I wonder if I could publicly host a pre-bundled version of jazz-browser and all its dependencies for simple importing?

I'm assuming preact class components work like old React classes - so instead of hooks the way to idiomatically expose subscribed CoValue state would be through a higher-level component?

rozek commented 2 months ago

as soon as I understand working with Jazz, i can also create a bundle myself and "publish" that on a GitHub page (like my automerge-bundle, f.e.)

Concerning preact and others: plain vanilla JS examples would be all I need - and these examples would help users of other frameworks as well