Live data from Hacker News

Build Your Own React

pomb.us

41–50 of 114 posts

Re: Build Your Own React

#41

Earlier quoted context omitted.

> webcomponent based router Routers can be (and should be, IMO) written to be independent of UI component libraries such as React and webcomponents. See an example here: https://github.com/Rajeev-K/mvc-router You can use it with React---and in some ways it works better than react-router.

Yeah I'm not a fan at all of react-router because it's too dependent on React. For redirecting, for example, they recommend you render a component. Which is just bananas to me.

The alternative would be to write a side effect inside your `render()` function, which is illegal -- it breaks the new Concurrent mode rendering, which can call render() speculatively.

I mean, I see why it's intuitively unappealing to you, but there are perfectly good reasons for the design.

Re: Build Your Own React

#42
post #16

Presentation is amazing here. That said, I recently wrote a webcomponent based router and I was surprised at how easy it was to get to a very usable point at such a minimal amount of code. All too often I get in the loop of just `npm i`'ing whatever it is I need, even if the functionality I really need is just a tiny subset of whatever huge library I'm importing. Rodrigo's right that something like this helps you und…

> you don't need that full 560kb library In fact, most web applications only need this 200-line library: https://github.com/wisercoder/uibuilder React started out as a simple library, but it is getting more and more complicated (see concurrent mode). 90% of applications don't benefit from React's complexity. This tiny lib has the same templating technology as React, but none of the complexity.

Concurrent mode seems to come out of actual research regarding managing what is rendered when and what people like / don't like and expect to be rendered and when ... and providing more control over that.

I guess that's complicated but I can see even basic apps benefiting from it.

Re: Build Your Own React

#43
I think concurrent mode and fibers are kludgy hacks that arise from the problem that only the main thread has access to the DOM. As far as I know and I may be ignorant but few, if any, other frameworks are scheduling DOM updates as aggressively as React is, and are simpler to understand as a result.

Hopefully the standards folks can come up with a decent DOM API for WebAssembly.

Re: Build Your Own React

#44
post #5

Very, very nice. His presentation library is available as well! https://codesurfer.pomb.us/ https://github.com/pomber/code-surfer/blob/code-surfer-v2/re...

I love this effect, I was actually just writing a blog post that I didn't save before my tab crashed. I'm actually now GLAD it didn't! This is a lot more effective a medium for the content! I even went ahead an set up a monthly donation to their open collective project [1] because it is so beautiful. 1: https://opencollective.com/code-surfer

hey, thanks a lot for the donation!

Re: Build Your Own React

#45
post #13

Along a similar vein, Sophie Alpert did a talk[1] at React Conf this year on building your own React custom renderer by using implementing the interfaces that React exposes. Sophie explains how you could use React as a declarative API for pretty much any platform if you wanted, similar to how react-native works. [1] https://www.youtube.com/watch?v=CGpMlWVcHok

Which is actually a little funny, because that's essentially turning React into a domain specific language for UI rendering. The Racket people are probably facepalming that we had to go via JavaScript and Babel to get to a UI DSL.

It is exactly that, a small library for ui, written in ocaml, ported to a scripting language with immense amount of work, and years and years of educating people with white lies :)

Re: Build Your Own React

#46
post #44

Earlier quoted context omitted.

I love this effect, I was actually just writing a blog post that I didn't save before my tab crashed. I'm actually now GLAD it didn't! This is a lot more effective a medium for the content! I even went ahead an set up a monthly donation to their open collective project [1] because it is so beautiful. 1: https://opencollective.com/code-surfer

hey, thanks a lot for the donation!

No problem, the tutorial was great and the code-surfer package looks great. Keep up the good work!

Re: Build Your Own React

#48
post #13

Along a similar vein, Sophie Alpert did a talk[1] at React Conf this year on building your own React custom renderer by using implementing the interfaces that React exposes. Sophie explains how you could use React as a declarative API for pretty much any platform if you wanted, similar to how react-native works. [1] https://www.youtube.com/watch?v=CGpMlWVcHok

Which is actually a little funny, because that's essentially turning React into a domain specific language for UI rendering. The Racket people are probably facepalming that we had to go via JavaScript and Babel to get to a UI DSL.

If Racket had a declarative UI DSL, I'd be using that, but they don't.

Re: Build Your Own React

#49
post #5

Very, very nice. His presentation library is available as well! https://codesurfer.pomb.us/ https://github.com/pomber/code-surfer/blob/code-surfer-v2/re...

This might even become standard for most documentations.

I found it very slick and cool-looking but not really conducive to absorbing information.

Re: Build Your Own React

#50
post #16

Presentation is amazing here. That said, I recently wrote a webcomponent based router and I was surprised at how easy it was to get to a very usable point at such a minimal amount of code. All too often I get in the loop of just `npm i`'ing whatever it is I need, even if the functionality I really need is just a tiny subset of whatever huge library I'm importing. Rodrigo's right that something like this helps you und…

> webcomponent based router Routers can be (and should be, IMO) written to be independent of UI component libraries such as React and webcomponents. See an example here: https://github.com/Rajeev-K/mvc-router You can use it with React---and in some ways it works better than react-router.

Web components are not a UI library though. They are the native component model for the web.
Post reply on HN