HNHacker News
TopNewBestAskShowJobs

leontrolski

2,204 karma · joined March 29, 2019

https://leontrolski.github.io/
submissionscomments
leontrolski··on Show HN: 33 line React
My feeling is that if html and js had syntactically shared data structures at their conception, we wouldn't have quite so much frontend mess as we do now and declarative UI would have been the norm for a while. Having said that, I'm not sure how much precedent this has in UI frameworks outside of the web.
leontrolski··on Show HN: 33 line React
Yeah, it's very mithril influenced (I love that library) - I namecheck them in the article at the top.
leontrolski··on Show HN: 33 line React
Great answer, thanks! Embarrasingly, I didn't even know about className :-)
leontrolski··on Show HN: 33 line React
In what way would you say the event binding here differs from React's? (Genuinely interested).

The main difference from where I'm sitting is that React has a concept of "Component state" - updates to which trigger local redraws. Here you have to manually call:

  renderNoughts()
any time you change state, this rerenders the whole mount point.

If I'm honest, React's state stuff has always seemed a little strange to me Would love people to try explain the point to me, is it just a performance related enhancement?

leontrolski··on Show HN: 33 line React
Agreed, let me know if you find a better way! I feel if the browser APIs were slightly more declaratively inclined, this article could be "10 line React".
leontrolski··on Show HN: 33 line React
I'm not sure if any of their content is still relevant, but mithril makes some bold claims for >React performance: https://mithril.js.org/framework-comparison.html#react

"Generally speaking, React's approach to performance is to engineer relatively complex solutions.

Mithril follows the less-is-more school of thought. It has a substantially smaller, aggressively optimized codebase. The rationale is that a small codebase is easier to audit and optimize, and ultimately results in less code being run."

(Obviously, I'm not claiming the same for this toy example - just that batching updates etc, may not be necessary for performance).

leontrolski··on Show HN: 33 line React
I'm not sure I can quite express what I'm thinking, but do you think this could be achieved orthoganally to the rendering library itself? (Just by "normal" js).
leontrolski··on Show HN: 33 line React
Author here, this was written as a way for me to explore the core idea of react in a minimal setting. Things it's missing

- jsx

- routing

- performance (maybe?)

- component state management stuff

What else would you include?

← PreviousPage 3 of 3