intercellular / cell

A self-driving web app framework
https://www.celljs.org
MIT License
1.5k stars 93 forks source link

Tabbed navigation demo #129

Closed mdings closed 7 years ago

mdings commented 7 years ago

Hello,

While playing around with cell I created the following demo: https://codepen.io/mdings/pen/awEOKJ.

The result is not that perfect because the content div flashes while the visibility of the other divs is being updated. So my question is whether the approach I've taken to create the navigation is the right one? Or is there a better way to come to the same result?

gliechtenstein commented 7 years ago

@mdings The reason there's a flicker is because you're you're putting it inside $update(). You should instead directly define them on the JSON object.

Based on reading your code I'm guessing you're coming from react and friends. Cell works differently from react. With Cell, what you see is what you get. You don't have to write all those boilerplate update codes. $update() is only for describing how something should "update" whenever there's a change in local variables (prefixed with _)

Here's how I would have written the same app https://jsfiddle.net/5d3zg5hn/

mdings commented 7 years ago

Who would have thought it's that simple!? :) Thanks @gliechtenstein

Coming from Vue btw