-
Notifications
You must be signed in to change notification settings - Fork 781
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
multiple app()
s / component approach / return dom
#2
Comments
So, it should not "auto mount". Maybe would be cool to return a function that when called to append to body, or that function can accept selector where app to be mounted |
If you set the |
Yea, it seems it work, but not work for nested components (or i dont know how to call it). Nested component (here TodoItem) should know who is the parent. It is easy to |
I just breifly read the source code, so I might be wrong, but I don't think that Also, why not define TodoItem like this
Clarification: I just breifly read hyperapp's source code |
I know that. And basically it could be possible to be used for components if change some bytes here and there. I actually don't like components way and things like that and |
Oh, sorry, I was not aware of discussion on reddit. edit: I think I found it. Very interesting, thank you! |
Correct.
Like I said on the Reddits, thank you for bringing this up. I think we may be onto something here. |
@tunnckoCore @tzellman @evgenykochetkov Here's a TodoMVC implementation using HyperApp. |
This is as far I think we can go with the current implementation of HyperApp. It's not just a matter of implementation, it's also a goal of the project to remain close to the Elm Architecture and use a single model for the entire application kind of approach. Docs have been updated to indicate this as well. |
SummaryThe original idea here was to make the return value of the app function a valid node type and make apps composable that way. This is not supported, but that doesn't mean you can't create multiple different apps and communicate with each other using whatever means possible, usually wired actions in V1 or the upcoming subscriptions API in V2. |
So, it is just amazing lib. A was working on some idea like that, code name
mitak
;d Based on events with just router, pub/sub system. For now it is 450bytes gzip. But yea, anyway.So the problem of return nothing just bumped while I tried to make a Todo List in components way.
So lets get started. We have 3
app()
s - TodoItem, TodoList and main.<li></li>
TodoItem
s, actions and view which is just like<ul>TodoItem()</ul>
main
TodoList
TodoItem
All is okey, but it adds Todo to DOM body two times
Passing
opts.root
seems to not deal with that problem.The only thing that I changed to the core source code, is to
return node
fromapp
function.The text was updated successfully, but these errors were encountered: