News for hackers. Stuff that matters.
Re:Thinking in React Hooks by dhucerbin on Thursday December 12, 2019 @02:32PM (#21775407)
To be fair, reagent uses it's own implementation that satisfy atom protocol. And it uses some funky magic with keeping derefs and triggering rerenders. In principle, as atom is idiomatic Clojure, setState is idiomatic javascript. ratoms and hooks both add some sugar to it.
Re:Thinking in React Hooks by pgt on Thursday December 12, 2019 @06:33PM (#21777714)
`setState(...)` is not idiomatic in JavaScript.
Re:Thinking in React Hooks by dhucerbin on Friday December 13, 2019 @03:26AM (#21779994)
I'm not sure how far back you want to go, but `this.set` is used in most frontend frameworks, starting around knockout and backbone. You had object which managed state for you (then it was model, today it is component) and it had some setter method.