Post

One thing I’ve changed my mind on when it comes to documentation is whether to discuss implementation details. The purist in me wanted to leave them out because “the whole point is you don’t need to know!” But in hindsight this paternalises consumers. It leaves them without a good mental model.

6 reposts116 likes

I'm actually considering writing a series of blog posts called "React Router Mental Models" to try to explain some of the parts of the current docs that I feel don't give enough context. Mostly coz I'm tired of answering the same questions over and over again in the Discord 😅

some items on my list.. - when loaders are called, when "revalidation" happens - loaders<->sessionStorage, or generally how to work with state when it's not in the URL - pairing with something like AGGrid server-side row model - non-trivial testing examples, when to rely on msw vs createRoutesStub

That's basically why I wrote my "Guide to React Rendering Behavior" post :) It's primarily external visible behavior rather than impl details, but it definitely tries to address that mental model due to consistent misunderstandings I see in the wild: blog.isquaredsoftware.com/2020/05/blog...

blog.isquaredsoftware.comBlogged Answers: A (Mostly) Complete Guide to React Rendering BehaviorDetails on how React rendering behaves, and how use of Context and React-Redux affect rendering

My dependency minimalism has trended up over time. As a beginner, I couldn't accomplish what I wanted without the help of black-box dependencies. But the more that I can implement things myself (or at least understand the implementation), the better I feel.

Too much documentation claims some sort of handy wavy magic when it’s really an abstraction over one or more web apis. YMMV but I find understanding what the abstraction does to be a helpful mental model for using that tool

I think documentation like that needs a model of progressive reveals. When you first learn how to use something, you want to see whether you can use it to achieve your use-case. As you dig deeper, it's useful to understand what's under the hood.

I think the problem with discussing implementation details in documentation is that you risk people relying on those implementation details in weird ways. I’d still like to see more of it, but I also understand there’s a trade off.

Consumers relying on implementation details is part of why I liked to keep them hidden. I don’t think it’s worth the trade off though. Knowing implementation details gives you more confidence to build on top, lets you better understand what’s possible, and gives you more context when debugging.