Live data from Hacker News

Build Your Own React

pomb.us

71–80 of 114 posts

Re: Build Your Own React

#71
post #51

Earlier quoted context omitted.

It's not really bananas when you actually start to think of everything 'as components', and consider that 'render' can neatly, declaratively describe behaviour, not just the DOM.

That _is_ how I think about components, but it's still bananas. Render does not neatly describe this behavior because it necessitates setting unnecessary state. That's gross. Usually when I need to trigger a redirect, I'm in some business-level function. So to redirect this way, I would need to set some state in my store, re-render, then hit the conditional, which would redirect, probably unset that state, and then p…

> When really all I want to do is in the business function, directly trigger the redirect and maybe some other logic without any indirection.

Heh, didn't see this comment before I left a novel up the tree. Seems we have similar ideas about state management.

I think the default RR API is straight React, and that is by design.

Re: Build Your Own React

#72
post #51

Earlier quoted context omitted.

It's not really bananas when you actually start to think of everything 'as components', and consider that 'render' can neatly, declaratively describe behaviour, not just the DOM.

That _is_ how I think about components, but it's still bananas. Render does not neatly describe this behavior because it necessitates setting unnecessary state. That's gross. Usually when I need to trigger a redirect, I'm in some business-level function. So to redirect this way, I would need to set some state in my store, re-render, then hit the conditional, which would redirect, probably unset that state, and then p…

Since you are talking about using Redux, you most definitely can dispatch push actions with libs like connected-react-router or just use the history API directly (for things like replacing state instead of pushing). Most of the redirects I write are inside business logic and I don't like mixing in there, too.

Re: Build Your Own React

#73
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 couldn't disagree more. This is not what a documentation should be like.

Unnecessary animations, fixed scrolling, and just useless "snazzy" aspects of user interface has no place in code documentation.

I hope this does not become the standard.

Re: Build Your Own React

#74

I really hate the layout and the annoying, distracting, animated garbage on the left side of the page. Maybe it isn't rendering properly in my browser, but I would greatly prefer a simple, wide, vertical layout.

I agree, it is simply astounding that the entire thread is filled with praising the presentation style which only gets in the way of the user. Anytime there is a need to add effects, animations, snazzy things - question ruthlessly as to why is it needed. Then after justifying it, ask again.

This is what good documentation looks like: https://golang.org/pkg/

And this: https://www.mpfr.org/mpfr-current/mpfr.html

Re: Build Your Own React

#75

Earlier quoted context omitted.

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

HTML custom elements (basis for web components) are intended for things that should be added to DOM. Using it for any other purpose is probably a misuse.

In my personal case I'm using it so the DOM is more literal as to what's happening on the page. I'm of the naive opinion that you should be able to read the DOM and have a general sense of what the site looks like. Since I'm making a single-page site that loads everything at once, I have a webcomponent based router that declaratively states what route will be active given the URL. For example:

    𝚖𝚢-𝚛𝚘𝚞𝚝𝚎𝚛
      𝚖𝚢-𝚛𝚘𝚞𝚝𝚎(𝚙𝚊𝚝𝚝𝚎𝚛𝚗="/𝚑𝚘𝚖𝚎")
        // 𝚜𝚘𝚖𝚎 𝚑𝚘𝚖𝚎 𝚙𝚊𝚐𝚎
      𝚖𝚢-𝚛𝚘𝚞𝚝𝚎(𝚙𝚊𝚝𝚝𝚎𝚛𝚗="/𝚗𝚎𝚠𝚜")
        // 𝚜𝚘𝚖𝚎 𝚗𝚎𝚠𝚜 𝚙𝚊𝚐𝚎

Re: Build Your Own React

#76
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...

Please don't perpetuate this type of animated presentation style. Why?

1) Vertical layout is easier to scroll

2) Vertical layout puts the code blocks in-line to know where they belong in the text

3) Author's presentation style has animations that slow down user's ability to scan quickly

4) Scroll position determines the code block's visibility (!!! WTF)

5) Either have the entire page white or black. The contrast changes between reading the document and then reading the code tires the user

6) Scroll wheel feels highjacked because the left pane is static

I could go on and on. I strongly discourage people from using this type of documentation. Your users, will get tired of the novelty and when push comes to shove, they will want something like this:

https://golang.org/pkg/

Re: Build Your Own React

#77

I really hate the layout and the annoying, distracting, animated garbage on the left side of the page. Maybe it isn't rendering properly in my browser, but I would greatly prefer a simple, wide, vertical layout.

I agree, it is simply astounding that the entire thread is filled with praising the presentation style which only gets in the way of the user. Anytime there is a need to add effects, animations, snazzy things - question ruthlessly as to why is it needed. Then after justifying it, ask again. This is what good documentation looks like: https://golang.org/pkg/ And this: https://www.mpfr.org/mpfr-current/mpfr.html

But this isn't documentation.

This is a tutorial, in which progression and transitioning between steps is a fundamental part of the content. Representing that transition via animations is not inappropriate.

Re: Build Your Own React

#78

Earlier quoted context omitted.

I agree, it is simply astounding that the entire thread is filled with praising the presentation style which only gets in the way of the user. Anytime there is a need to add effects, animations, snazzy things - question ruthlessly as to why is it needed. Then after justifying it, ask again. This is what good documentation looks like: https://golang.org/pkg/ And this: https://www.mpfr.org/mpfr-current/mpfr.html

But this isn't documentation. This is a tutorial, in which progression and transitioning between steps is a fundamental part of the content. Representing that transition via animations is not inappropriate.

It looks cool, but it is inappropriate because it wastes time since the transitions take time.

Re: Build Your Own React

#79
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...

Please don't perpetuate this type of animated presentation style. Why? 1) Vertical layout is easier to scroll 2) Vertical layout puts the code blocks in-line to know where they belong in the text 3) Author's presentation style has animations that slow down user's ability to scan quickly 4) Scroll position determines the code block's visibility (!!! WTF) 5) Either have the entire page white or black. The contrast chan…

I think static documentation (your link) is a different use case than an interactive tutorial (not documentation). I didn't find the presentation horrible, but it's likely just looking nice and perfect on my computer hooked up to big monitors, and not on a phone or something....

Re: Build Your Own React

#80
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…

Especially when you consider a non-trivial amount of the react-dom codebase is actually Synthetic Event handling (smoothing out differences in browser implementations). If you're using "the platform" and understand native events, that's a huge saving for you and your users.
Post reply on HN