4 ms·
It looks similar to React's one-way data flow - that render method produces the whole app view, and refers to all the necessary variables. When an event occurs
by creamyhorror 11y ago
It looks similar to React's one-way data flow - that render method produces the whole app view, and refers to all the necessary variables. When an event occurs [e.g. the user types text to add and hits enter]:
- the appropriate method is called [e.g. add]
- which mutates the state [e.g. TodoList.push(TodoItem.new(title.trim))]
- and then render is called, which updates the view/DOM
So in a sense it's not really data-binding, IMO - instead, the render method contains the entire view + view logic, and it gets called each time the state is changed.