News for hackers. Stuff that matters.
Re:15 years trying to make everyone separate HTML, JavaScrip... by Robin_Message on Tuesday December 20, 2016 @01:35AM (#13217944)
Look again; it doesn't mix presentation and (business) logic. It's all view, with the added bonus of not needing to code state transitions in the view.
Re:15 years trying to make everyone separate HTML, JavaScrip... by Chris_Newton on Tuesday December 20, 2016 @01:40AM (#13217962)
Look again; it doesn't mix presentation and (business) logic.

Unfortunately, the example from the tweet really does: the storage and manipulation of the to-do list itself is right there, mixed in with the rendering component. I think it’s a bad example of how to write UI code using React, because while it’s concise and it works, the techniques it shows lack flexibility and don’t scale well, and they’re not how you’d actually write a larger app’s UI that renders using React.

Re:15 years trying to make everyone separate HTML, JavaScrip... by Robin_Message on Tuesday December 20, 2016 @07:56AM (#13219377)
True; I was only looking at the render method, which I think is pretty pure, and should indeed be more separated from the business logic.