anthonyshort / deku

Render interfaces using pure functions and virtual DOM
https://github.com/anthonyshort/deku/tree/master/docs
3.41k stars 130 forks source link

Enabling plain functions as components #352

Closed Yomguithereal closed 8 years ago

Yomguithereal commented 8 years ago

Just a proposition to add plain function as components. I know that you might have dropped it because it seems to exist in the Quick Start section but is actually not implemented.

Related to dekujs/deku#350.

kesla commented 8 years ago

cool!

anthonyshort commented 8 years ago

Sounds good to me. I originally left them out just to keep it simple, but this does the job easily.

Yomguithereal commented 8 years ago

It's just that it is sometimes cumbersome to create an object with a render key when your component will never be more than a rendering function.

rstacruz commented 8 years ago

I personally don't mind not allowing functions as components. Writing your components as { render: () => ... } makes it easy to 'upgrade' that component later on, plus it means there's only One True Way To Do Things™, making it simpler to grok for a new-comer.

Yomguithereal commented 8 years ago

The coward option is to let the option exist while not directly documenting it :smile:.

anthonyshort commented 8 years ago

Yeah now we need to document it :D If anyone has some free time, go for it and I'll merge it in.