Excuse me, I was looking through overview of choo on main website and I never did find example of using choo without routing. Is it possible? I'm using typescript so I mainly check the types to see if there is something I need. I see that .mount accepts only 1 argument and it is selector.
How can I create reusable components for like just mounting them somewhere in html (if I already have html - not for SPA)? Came here after reading something about simplicity and reusable components on main website.
Thanks!
Not sure if the store code is consumable on its own, but its easy to recreate.
I did this once at work: https://github.com/netlify/netlify-identity-widget/blob/nanocomponents/index.js
Basically create a class that extends nanobus, create 'stores' ( called them handlers in the above project, but probably call them stores if I were to go back and change things) by exporting functions that attach listensers/emitters and store things on a state objected that lives in the parent class, and when you emit('render') call render on an owned nanocomponent.
Pretty simple and can be adapted to your needs.
@bcomnes ah! So the best option not to use choo for this task but nanocomponent?
I believe if you use choo, you are tied to the global choo router, so if you don't want that, this is one alternative. Nanocomponent as designed to work well with choo, but also be self hosting.
There's also this project https://github.com/graforlock/choo-detached
I've used this in that past and has worked great for treating a choo app as just a component
Yeah, think https://github.com/graforlock/choo-detached and https://github.com/heyitsmeuralex/nanochoo are the two main premade options right now. Choo itself probably won't drop the router anytime soon :)
Most helpful comment
There's also this project https://github.com/graforlock/choo-detached
I've used this in that past and has worked great for treating a choo app as just a component