Closed marcelklehr closed 6 years ago
Yeah, would like this as well! Now hyperapp/router doesn't work with nestable components š
@marcelklehr @tino
š¤ Hmm... Well, the use-case for nestable is mainly when you have a component that needs some local state that the rest of the app doesn't care about (like form validation, for example -- the rest of the app only cares about a valid form submission). Therefore, it doesn't make much sense to me to integrate nestables' state into main-state. The whole reason I wrote it was to keep state out of the main š
It sounds to me (although I may be mistaken, ofc) that maybe what you're looking for is a way to write encapsulated modules containing state, actions, and views (essentially standalone apps), in such a way that you can compose the modules (not just the view, but state and actions also) together into a larger app.
If that's what you're after, perhaps this post I wrote could give you some ideas:
@tino fwiw the router is kind of tricky, and not very robust in my experience. Even if you're not using nestable, there are issues and gotchas to be aware of. I would try to keep things as vanilla as possible if I were using hyperapp/router
@marcelklehr I'm going to close here for now, since I'm not sure what it is you're proposing exactly. Hopefully the link I shared above can provide you a path forward. Otherwise, please reopen if you have like a pseudo-code example to clarify what you need.
BTW, I realize I left this open 3 weeks before answering! My sincere apologies! I just didn't notice it until a couple of days ago.
šš¼ For that post. It is indeed what I was looking for but couldnāt find in everything going on around hyperapp. Thatās also the reason I got to use nestable.
To be fair,
the use-case for nestable is mainly when you have a component that needs some local state that the rest of the app doesn't care about Is what I sttempted: one āpageā doesnāt need to know about another page. But it does need to be able to navigate somewhere else ;)
And when we come into ālooselyā coupled land, Iām not sure it matters/makes sense to have a single state, as you wouldnāt want to rely on things innp the global state anyway as thatās tight coupling.
Hey @zaceno !
This is what I've been looking for. Awesome stuff! What I've been wondering is whether it would be possible to integrate the sub-app's state into the state of the main app? This would allow writing components as apps that are much more encapsulated than the normal components which need to declare their state and actions on the main app, requiring some central bookkeeping, afaict.