Kent C. Dodds

kentcdodds.com · Personal blog · on HN since 2015

Kent C. Dodds, a JavaScript and React educator, writes about testing, abstraction, state management, and structuring web applications.

What HN saysCommenters recommend him for JS and React advice, especially his write-tests post, whose testing trophy changed how some of them think about testing.
99HN people shared it
50linked it in comments
62stories submitted
321story points
7 months agolast shared
2015people per year2026

Most-shared posts

  1. 1
    Write tests. Not too many. Mostly integration
    12 people · 9 points · first shared 2019 · 3 comments on HN
  2. 2
    How I built a modern website in 2021
    9 people · 97 points · first shared 2021 · 154 comments on HN
  3. 3
    Avoid Hasty Abstractions (2019)
    9 people · 7 points · first shared 2019 · discussion on HN
  4. 4
  5. 5
    When to UseMemo and UseCallback
    6 people · 1 points · first shared 2020 · discussion on HN
  6. 6
    Maintainability Through Colocation
    4 people · 21 points · first shared 2019 · 3 comments on HN
  7. 7
    Application State Management with React
    4 people · 3 points · first shared 2019 · discussion on HN
  8. 8
    Goodbye Medium
    3 people · 55 points · first shared 2019 · 22 comments on HN
  9. 9
    Stop Being a Junior
    3 people · 6 points · first shared 2023 · 1 comments on HN
  10. 10
    Stop Mocking Fetch
    3 people · 4 points · first shared 2020 · discussion on HN
  11. 11
    Fixing a Memory Leak in a Production Node.js App
    3 people · 3 points · first shared 2023 · discussion on HN
  12. 12
  13. 13
    JavaScript to Know for React
    2 people · 5 points · first shared 2019 · discussion on HN
  14. 14
    Use ternaries rather than and& in JSX
    2 people · 5 points · first shared 2021 · 1 comments on HN
  15. 15
    A review of my time at Remix
    2 people · 3 points · first shared 2022 · discussion on HN

What HN people wrote when they linked it

ijames55 · 2021-05-27
Surprised I haven't seen https://www.swyx.io/ mentioned for articles in the JS world and general dev stuff https://kentcdodds.com/ Is also great for JS, React especially testing opinions
sverhagen · 2024-10-19
This model ("mnemonic") feels like a good tool to reason about your testing strategy. I ran across the "testing trophy" in the past, which really changed my thinking already, having been indoctrinated with the testing pyramid for such a long time before that. I wanted to share my favorite links about the testing trophy, for those interested: https://tanzu.vmware.com/content/videos/tanzu-tv-springonetour-win-a-s… https://kentcdodds.com/blog/the-testing-trophy-and-testing-classificat…
willio58 · 2023-06-20
Totally agree. In the past year, I've started getting my org into writing tests, and it's pretty hard to find the "right" way of doing things. Everyone is so opinionated, which is fine but they're all opinionated in different directions. I've found some solace in finding one person that's really experienced in writing tests for my specific platform, and kind of following their blog as a "bible" of sorts. cough https://kentcdodds.com/blog cough
hbrn · 2023-02-19
Coverage is the best example of Goodhart's Law, never focus on it. Integration tests are typically best bang for buck: https://kentcdodds.com/blog/write-tests Once manual testing starts causing noticeable pain, you can start automating some of it. This may very well be beyond $10-100M in valuation. A lot of people say unit tests give them confidence, but that's a delusion. Losing confidence in your code means you have outgrown your architecture. However, you can temporarily address it with more tests, because addressing architecture issues takes some time. The secret is to write as little tests as possible to bring confidence back to acceptable level. Don't spend more than 10% time on tests. Don't let junior engineers write tests.
robertwt7 · 2022-08-17
The blog is sooo good! I enjoyed every single paragraph when reading it. If you're confused about the last part where it mentioned where useMemo and useCallback can help when passing props, I completely understand after reading Kent C Dodds block and Dan Abramov. Further, I learned a lot by taking interactive course from Dan Abramov in https://justjavascript.com Highly recommended! good read!! https://kentcdodds.com/blog/usememo-and-usecallback https://overreacted.io/a-complete-guide-to-useeffect/
nop_slide · 2021-10-25
Interesting, I mostly followed this approach which is to basically never use those constructs unless you are 100% certain you know what will happen. https://kentcdodds.com/blog/usememo-and-usecallback TLDR; > Specifically the cost for useCallback and useMemo are that you make the code more complex for your co-workers, you could make a mistake in the dependencies array, and you're potentially making performance worse by invoking the built-in hooks and preventing dependencies and memoized values from being garbage collected. Those are all fine costs to incur if you get the performance benefits necessary, but it's best to measure first.
cheeew · 2021-10-25
I've normally heeded to the advice from Dan Abramov (https://overreacted.io/before-you-memo/) and KCD (https://kentcdodds.com/blog/usememo-and-usecallback): mainly due to the fact that I figured performance would take a significant hit by using unnecessary React.memo / useMemo calls throughout the codebase. One negative side-effect I could see as a result of this pattern is devs becoming too reliant on these optimizations and neglecting composition. But I suppose if the performance gain is substantial enough and DX isn't negatively impacted too much, it could serve as worthwhile-- especially at the level of scale which Coinbase requires.
dangerwill · 2021-10-10
Because every inch of this website is dripping with scummy MLM language around his courses and we as an industry have seen scams proliferate around preying on people trying to make it in tech. https://cryptobriefing.com/youtuber-techlead-accused-of-scam-as-millio… for ex. It offends me morally. Like, look at https://kentcdodds.com/clubs for example. Doesn't this read as patronizing at best and one step away from being a pyramid scheme at worst? All it takes is to add a financial incentive to the "Learning Club Captain" position for this to literally be a pyramid scheme.
darekkay · 2021-05-26
> I don't recall where I picked up from, but the best advice I've heard on this is a "Rule of 3" I know this as AHA = Avoid Hasty Abstractions: - https://kentcdodds.com/blog/aha-programming - https://sandimetz.com/blog/2016/1/20/the-wrong-abstraction
bennettdams · 2021-03-08
The combination of React's native context with hooks and realizing that a lot of your state is just "server cache" data (which can be handled "better" than using Redux) is probably enough for 95% of React applications. Kent C. Dodds has a great article covering both topics: https://kentcdodds.com/blog/application-state-management-with-react
duxup · 2020-04-27
The docs are great for a given tidbit, but for structure and "why" I personally don't always get that from the docs and I end up reading something from Kent that tells me why. https://kentcdodds.com/blog/usememo-and-usecallback Granted that's probably because on a good day my reading comprehension is not great and learning within a narrative works way better for me.
veeralpatel979 · 2020-02-10
Hey - author here. Try Redux; acemarke has been evangelizing Redux Toolkit [1] recently and it looks great for a beginner not familiar to the Redux ecosystem. But also - if Redux just isn't clicking for you, or if it is but you feel like writing it is unnatural - know that you're not alone. Learn MobX, learn how to manage state with context and hooks [2], learn Apollo Client. Yes it's a lot of up-front work, but you really do need to find a state management approach that works for you if you want to write non-trivial apps, in my opinion. [1] https://redux-toolkit.js.org/ [2] https://kentcdodds.com/blog/application-state-management-with-react
blakesterz · 2019-03-19
Someone might want to update that link to the real post: https://kentcdodds.com/blog/goodbye-medium He's leaving for the reasons that you'd expect. It's a good read, though not at all surprising.
zeorin · 2025-07-29
React is easy, once you understand why {} !== {} and that it uses reference equality as a proxy for value equality. This is why the absolute simplest thing to do is to just memoize all the things (see https://attardi.org/why-we-memo-all-the-things/ for a deeper dive into this approach). I know that the conventional wisdom (e.g. https://kentcdodds.com/blog/usememo-and-usecallback) is not to do that, but it's worth noting that Kent doesn't actually bring receipts for his claims, and also the discussion is typically limited to toy examples, not huge applications that have the potential for huge cascading renders when anything changes. In my own profiling of real world applications I have found that memoizing everything is not actually a performance regression. And then also consider the React Compiler, which of course does the same, at an even more fine-grained level than any human could be bothered to consistently do by hand.
dcre · 2023-10-23
Worth noting that in my experience it's the combination of MSW and code generated from an OpenAPI spec that really makes it special, not just MSW alone. The other reply covers it but I want to slice it slightly differently. I see two things that are different here. One is mocking at the HTTP boundary rather than mocking, e.g., function return values or modules or whatever. That's certainly not revolutionary (I know people do it with rspec and I'm sure plenty of test frameworks do it too), and in theory you could build your mock server with any tool that lets you build a server. But people don't usually do this, and when they do they tend to do it bit by bit for each test rather than thinking about it as mocking the entire API. So for example, in my mock API, my POST creating a project actually creates a project in a mock database, and then when I list projects, I can see what I just created. So I can test the UI by doing exactly what you would do manually — create the thing and see that it shows up where it's supposed to. All of that is built independently of my test for that feature, and it works for all the tests I write — I don't have to think about mocking API bits for a particular test. Worth a read: https://kentcdodds.com/blog/stop-mocking-fetch The other thing that's unusual is running this mock in a Service Worker, which means it can run in the browser. That's pretty cool and pretty unique to this tool. But the Mock part is about running the same server outside of…
lucasyvas · 2023-05-12
Without fail, every article from Kent C. Dodds shows what appears to be total inexperience despite claims of the contrary. The advice is, at this point, almost meme worthy. There's an infamous post from 2021 (that he may have been roasted for here): https://kentcdodds.com/blog/how-i-built-a-modern-website-in-2021 Almost every single piece of advice is wildly overcomplicated and ridiculous. I do like some of the technologies proposed, but you can host this stuff on a single VM without any of the fancy frameworks, tools, or hosting options. Kent is the only blogger that I've felt compelled to tell all my less experienced colleagues to completely ignore, and I feel entirely justified doing so whenever they bring him up. The proliferation of his perspective has, quite literally, been a pain in my ass daily trying to re-teach misguided fundamentals. I really don't understand who the intended audience is. The expert beginner, maybe? I'm sure he's probably a wonderful human being, however.
acemarke · 2022-12-21
Seems like most of the issues here are caused by an incomplete understanding of how React rendering actually works. That's why I wrote an incredibly extensive article on this: "A (Mostly) Complete Guide to React Rendering Behavior". I'd strongly recommend reading through that to help internalize what React is doing and how re-rendering works: - https://blog.isquaredsoftware.com/2020/05/blogged-answers-a-mostly-com… In general: yes, *React re-renders recursively by default*. Also: yeah, _no_ web app will update as efficiently as a 3D game engine, because it's under completely different technical constraints. On the other hand, web apps are also a completely different _kind_ of application than a 3D game as well, and the DOM is a different display environment than rendering 3D models and executing physics logic. Also, the article said: > I would like to acknowledge that there should be “some” overhead from using the development build, but I wouldn’t expect turning on production mode would have a substantial impact on this example. There _is_ actually significant difference between dev and prod build performance. By default, profiling only works against development builds, but there's two ways you can try measuring the render time of a production build: - Alert your build setup to alias "react-dom" to the special profiling build, which is a production-like build that still has the profiling logic enabled, then use the React…
cogman10 · 2026-03-12
If you can't tell, I actually think functional tests have a lot more value than most unit tests :) Kent Dodd agrees with me. [1] This isn't to say I see no value in unit tests, just that they should tend towards describing the function of the code under test, not the implementation. [1] https://kentcdodds.com/blog/the-testing-trophy-and-testing-classificat…
danjl · 2024-10-17
That's funny, since I wouldn't code at a place that mandates unit tests. Sure, they have a very minor role, in very specific cases, but I'd say 90% of projects can get 90% of the benefits by writing only integration tests with 90% coverage. If you'd like a more in-depth discussion of why integration testing is better: https://kentcdodds.com/blog/write-tests
vi2837 · 2024-05-30
I wonder why nobody mentioned it - there is one more advanced principle AHA: (Avoid Hasty Abstractions) https://kentcdodds.com/blog/aha-programming#aha- Overusing the DRY principle can make software almost unsupportable.
fiznool · 2024-02-28
You might be interested in the ‘testing trophy’ as an alternative to the traditional pyramid. https://kentcdodds.com/blog/write-tests
shepherdjerred · 2023-09-22
Reading the "Technology Overview" section of the linked "How I built a modern website in 2021" [0] site is terrifying. It lists something like 15-20 technologies to build the site. I guess most of them are beneficial, but... why are some so proud of how large their dependency tree is? [0]: https://kentcdodds.com/blog/how-i-built-a-modern-website-in-2021#techn…
LadyCailin · 2023-07-08
Tests should mostly be integration, not unit. Unit tests tie you down to the specific implementation, which means changing the implementation becomes much more onerous. Integration tests have much more value, give you higher confidence that the code does what it claims, and is easier to code review. https://kentcdodds.com/blog/write-tests
tuzemec · 2023-05-15
I've stumbled upon this post about building simple state machines [1] a while ago. I was working on a small game and it helped a lot with the "enemy' behavior. [1] - https://kentcdodds.com/blog/implementing-a-simple-state-machine-librar…
tiberriver256 · 2022-07-07
I think Kent C. Dodds gets to the goal behind the DRY principle fairly well here: https://kentcdodds.com/blog/aha-programming
exclipy · 2022-02-06
> That would mean that "making your code easier to test also improves its design" is wrong. I assume that quote is talking about unit tests, but it's becoming more and more accepted that integration tests are more important than unit tests. https://kentcdodds.com/blog/write-tests This shift away from unit tests is the corollary to Ousterhout's preference for deep modules.
kanonieer · 2021-12-26
Seconded. There was a series of similar Twitter discussions when a popular JavaScript "influencer" published an article[0] on how they built their website. The amount of complexity that is self-inflicted in the said article was obviously enormous for proponents of MPAs. However the JS community mostly echoed that the complexity was absolutely within norm. The cultural chasm between JS developers and people who push for simplicity was huge. And the refusal to admit the unnecessary complexity was nothing short of Stockholm Syndrome, imho. [0] https://kentcdodds.com/blog/how-i-built-a-modern-website-in-2021 This was the HN reaction to the article: https://news.ycombinator.com/item?id=28818829
crate_barre · 2021-10-25
why can't you just build your REST API on the Express backend Pretty sure he means to set up the REST api in Express with a few simple routes. JS is not complex, and pretty vanilla choice. It’s what people add on top of it that gives it a bad name. I’ll link to this guy so you can understand: https://kentcdodds.com/blog/how-i-built-a-modern-website-in-2021 ^ This is the problem, not JavaScript.
swyx · 2021-10-11
Congrats team! For those not close to the React ecosystem, here are the main things to catch up on with Remix: - Kent's website breakdown: https://kentcdodds.com/blog/how-i-built-a-modern-website-in-2021 - Beta launch video: https://www.youtube.com/watch?v=4dOAFJUOi-s&t=1s -

Keyboard shortcuts

/Search
j kNext / previous blog
EnterOpen selected blog
vVisit the blog site
fFollow / unfollow
lSwitch grid / list view
dSwitch dark mode
g hHome
g pTop posts
g tTopics
g fFollowing
g lLiked
g yHistory
g qFAQ
EscBack / close