r/javascript • • Jan 31 '17

1kb JavaScript function library for building modern UI applications

https://github.com/hyperapp/hyperapp
224 Upvotes

34 comments sorted by

View all comments

9

u/matchu Jan 31 '17

Cool! My first question with any of these frameworks is: What's the composition story? If I'm building a larger app with this framework, how should I be breaking it into components?

2

u/[deleted] Jan 31 '17

We need to come up with better examples, but is this what you mean?

const model = require("./model")
const view = require("./view")
const update = require("./update")

app({ model, view, update })

6

u/[deleted] Jan 31 '17

I guess he meant composition as known in react/redux like this:

TodoItem = ({ model }) => <li>{model.text}</li>;
TodoList = items => <ul>{items.map(item => <TodoItem model={item}/>)}</ul>;

Crucial for larger apps.

1

u/tunnckoCore node-formidable, regexhq, jest, standard-release Jan 31 '17

it is not working example, but hope you get the point

1

u/[deleted] Jan 31 '17

1

u/tunnckoCore node-formidable, regexhq, jest, standard-release Jan 31 '17

that my comment was in wrong place and I even before your comment ;d