Closed gaydenko closed 9 years ago
Hi, @gaydenko! Vidom components is a way to create reusable high-level parts which encapsulate all complex structure and behaviour within. Component is not a virtual node. Component is attached to the corresponding virtual node. Component spawns its own virtual tree which is hidden from outside.
Maybe I don't understand your question, do I? Which way do you propose to create reusable parts?
@dfilatov , hi! Thanks for the clarification.
which is hidden from outside
Aha, this is a core idea.
Which way do you propose to create reusable parts?
I guess reusable parts at any sense must be outside of a core library implementing virtual DOM. So I would suggest to leave this problem to end developer :) (As for me, I use own framework partly based on Nicholas Zakas ideas regarding reusable parts (called "modules" at that time), and, by the way, the parts can be not-visual).
To summarize, I would suggest to avoid components at all (at least in core library), and to add life-cycle hooks to all virtual tree nodes (something similar Trackira and Snabbdom have got).
I'm closing the issue as far as you have answered the question, thanks!
@gaydenko Thanks for participating!
@dfilatov , hi! I try to understand the value of components abstraction and can not get it :) If I understand correctly, generally vidom component is just a node with life-cycle hooks. Can you, please, clarify a little? In particular - why the simplest way is avoided? By "simplest way" I mean just a tree every node of which has got life-cycle hooks.
That is in sense of life-cycle all nodes are equal. End developer's mind is free from mental exercises in juggling this great and awful multi-valued all-and-nothing word "component" :)