I'm Kent C. Dodds. I help people make the world better through quality software. Ask me anything!
Hey Hashnode community, 👋
I am Kent C. Dodds. I'm a software engineer and teacher. I've written code for More Good Foundation, The Church of Jesus Christ of Latter-day Saints, USAA, Domo, Parakeet, Workfront, Alianza, PayPal, and my open source code has been used by millions of people all over the globe.
Ask me about:
- Open Source
- Content Creation
- My Faith
- My Politics
- My Youth
- Anything means anything...
I will start answering your questions live on Tuesday, 11th Feb, 9 AM PT / 12 PM ET / 5 PM GMT.
Learn Something New Everyday,
Connect With The Best Developers!
I'm a big fan of yours and will be attending your React Suspense workshop at Reactathon SF this year!
I was wondering how you decide what UI components to test? Currently, the project that i'm working on has almost a 1:1 component : test file mapping, where each file is enzyme shallow mounted and unit tested in its separate test file.
To avoid testing implementation details, one of the first pieces of advice you give is to fully mount your components instead of shallow mounting them. However, if I do this in all my test the way they are currently structured, it seems we test many components multiple times in a way that feels redundant.
I was wondering if this redundancy is actually okay, and if not, how you decided what components to test in what way?
That's great! I look forward to meeting you at the workshop :)
This is a great question. Your intuition is correct that there are many components that are useless to test (especially when they're being covered by higher-level tests). This blog post may help: How to know what to test. Good luck!
Hi Kent! What advice would you give to improve the quality of blogs? Any advice in choosing the topics to write about, the structure of the article, or how to make it easier for beginners.
Structure and making it easy for beginners is the kind of thing that comes with lots of practice. When I was starting out, the ideas I got for blog posts came from things I was learning every week. Everyone learns something new each week. Write about that. Or sometimes I write about something I want to learn (Super Simple Start to ESModules in the Browser is an example of this). Over time, I get people asking me questions about things and when I get asked the same question over and over, I write a blog post about it so I don't have to repeat myself. Having an AMA on GitHub is another helpful way for me to get inspiration and keep track of ideas.
Another thing you might find useful (with regard to helping make it easier for beginners): How I Teach
With all of this, the real success comes with consistency. And don't be afraid of publishing something that's not perfect. You can change it later. Just get that content out there! Good luck!
What advice would you offer to developers who don't have a personal blog yet? How important is owning your content in comparison to giving away your articles to platforms like Medium?
Note: Articles published on Hashnode live on authors' personal domains via our Devblog initiative.
It depends on your goals. Do you want people to refer to your content as "Sandeep's content" or "Medium's content"? When people find a cool post on Medium, they tell their co-workers: "Hey, did you see that cool article on Medium about XYZ?" When people find a cool post on Sandeep Panda's blog, they tell their co-workers: "Hey, did you see that cool article on Sandeep's blog?" Especially with what Medium has done recently with annoying popups and the paywall, I wouldn't touch Medium with a 9 foot poll. In fact, even when I was publishing there, the only reason I did it was because I didn't want to take the time to build my blogging platform at the time, but Medium allowed me to create my blog on Medium under my own domain (so I owned the URL). I never would have done it otherwise. And now, because I owned the domain, I can redirect all my posts to where they are now, meaning I don't lose all that social juice I worked for. (Watch me work on that). Good luck!
What's the one thing about you which people don't believe easily? 😉
What are you opinions on monolith repos vs having concise separate repos? For example: component libraries consumed by multiple isolated front end apps that need to maintain versioning, etc?
I've been a long time fan of the later, but local front-end development feels harder now after React Hooks where the same instance of React needs to be npm linked to avoid errors. Related, what are your opinions on yarn workspaces and learna?
It's been a little over a year since I used a monorepo (via yarn and lerna) for a component library at PayPal. It was a little complicated, but it worked well. If I were to do it again, I probably wouldn't have bothered. Most people using the PayPal component library internally would need several of the packages so they all probably would've just installed the one package that installed everything anyway, so there's no benefit to splitting them up for that reason. One drawback to this is that a breaking change in any of those components results in a major version bump of the collective package which is annoying, but since almost everyone would be using the one collective package, it doesn't really bring any benefit to splitting them up and really just makes things more complex.
I definitely wouldn't build something like that as concise repos. That would be really hard to manage after just a dozen components or so.
So putting them all in a single repo in a way that's well structured and organized in individual folders for each exported "module" would be the way I would go if I did that again today.
Imagine you have the following two job offers with 2 years of Backend experience, which one would you choose? And why?
Offer 1: High pay scale, great office, excellent employee benefits, MNC, not sure about the work challenges and projects.
Offer 2: Pay scale less than expected, challenging startup, few employees, and interesting projects.
I think this is a really personal question. I know that I would personally choose offer 2, but that's because I enjoy the challenge and interesting projects more. Something that might help you a lot is this conversation I had with Cassidy Williams on my podcast: Establishing Your Personal Brand - with Cassidy Williams
Hope you are doing good :)
My question: Should a company (mid size) be making it’s own framework (on top of a library, say React)? Will making abstractions help?
Wrapping abstractions is often a good idea because it allows you to swap abstractions for free*. That said, if you try to change to a new abstraction that completely changes the programming model or API, or the hoops you have to jump through to maintain consistency in the API in a way that results in performance problems or something then is it really worth the effort? The wrapping doesn't come for free after all, so you have to know that it's worth the cost.
With something like React, the requirements of that abstraction will be all over your codebase. If you try to wrap that and then later swap the underlying implementation to Angular for example, that will be functionally impossible.
So if you're asking about wrapping React and having people use your own APIs instead of Reacts, then I'd question the value there.
If you're just talking about making a framework on top of React to allow people to build apps at your company faster, then that's a different thing entirely. Something like Next.js or Gatsby fall into this category. They don't hide React, they just add some opinions. I did this at PayPal, and I recommend it. If you have more than four or five unique applications that you're building at your company, then building a toolkit or framework can save you a lot of time. Though a toolkit as I mention in those posts isn't quite the same as a Next.js or Gatsby. You should be able to build a toolkit on top of those and you'll benefit from those larger communities.
I hope that helps. Good luck!
An aspiring Fullstack Developer, currently mastering front-end. I love writing and teaching others the little I know. Join me on my journey.
What advise would you give to someone who's studying software development and would like to, someday, be a coding educator or instructor?
Start educating and instructing today! You already know something that people can learn from you. Start teaching it and you'll solidify what you understand about that topic and you'll also develop a name for yourself as an instructor and get practice at the process of teaching. This may also help: Solidifying what you learn. Good luck!
I've been hearing more lately about "low code" picking up steam. Google recently acquired App Sheet, etc. Do you have any thoughts on the future of this paradigm and how much developers should be adding this to their skill sets?
I'm pretty confident that once computers can do the job of a developer, we'll either be a utopian society and traveling the stars, or we'll be hiding in caves from our robot overlords. I think it's important to keep an eye out for new advancements as they come, and not just put your head in the sand about it, but I don't think that the modern development jobs of today are going away any time soon.
At this point I'll take any functioning + sane adult in the Whitehouse, but if I had to pick today I would probably go with Elizabeth Warren or Bernie Sanders. I find it interesting that you've so outspokenly endorsed Yang, who seems like such a fringe candidate to me. So, what's your pitch for Andrew Yang? What differentiates him from other candidates in ways that makes him a better pick, in your opinion?
Andrew Yang really seems to be speaking to the problems that I feel like the country is facing and the solutions he's presenting seem to me like they would actually work. He always backs his claims with data and studies. I also really like his attitude against the general vindictive and animosity we feel in the country across party lines. He seems like he genuinely wants to solve the problems and the solutions he presents make sense.
Also, I honestly feel like he's the only candidate that can beat Trump. Nobody else is pulling support from republicans and independents like we'll need to defeat Trump. If someone else gets the nomination, then I'll be very concerned about the general election. If Yang gets it, I'll feel very confident that he can win the whole thing.
Oh, and he's the one who's really thinking about the impact of technology on our future. I don't think anyone else really understands what's coming like he does. The fact that he's thinking about that and has a plan to address it is comforting to me. I don't think he has everything 100% right, but I think he's most prepared to monitor the right signals and make the right adjustments during his 8 years in the white house.
why would you choose to write a codemod in babel over something like jscodeshift? Do you think babel has a better api?
Exactly. I've tried using jscodeshift several times and always got lost. The babel API (the visitor pattern) is just so much simpler for me to work with, so that's what I go with :)
Hi Kent. Do you have any plans with Vue, either content or live stream?
Watching you jump in and work through things in React is very helpful for someone sticking their toe in the water, and I'm sure myself and others would love to see the same in Vue.
Re-iterating on a similar question - If I do have the time and the cost to spend on writing e2e tests, do I still need unit or even integration tests? Assuming it's a small application and writing e2e tests would not take us too much of time.
Note that E2E is the only level where I feel comfortable saying that. I don't think you could really consider yourself "safe" with any other level of the testing trophy alone.
Thank you Kent C. Dodds That is particularly the reason why I did not wanted to invest time into writing unit tests for my components as the overall functionality is already covered by the e2e tests. It makes me feel more confident about the overall functionality of my app. I only feel the need of unit tests for certain utility functions and helper functions may be.
Do you think everyone should learn to code? In other words, should kids be encouraged to learn programming early?
I don't think it should be at the same level as reading, writing, and math, but I do think that everyone should be exposed to it, and at an early age. The thing about coding is that when you're just getting started with it, you learn and apply skills that everyone should definitely have even if they don't end up being coders. So the same path you take to start learning (especially for kids) will teach you skills you'll need anyway. And in the process you might find that you really like coding in general and decide to pursue an enjoyable and lucrative career.
What are some developer tools that you can't live without?
What have you learned as a developer, educator, entrepreneur, etc... that has helped you be a better father / husband? And vice versa?
I like to think that being a good husband and father are among my highest priorities in life. The reason I do what I do is so I can provide for my family and also buy more time to spend with them. The fact that I'm working for myself and working from home allows me to spend more time with my family. As soon as my kids get home from school, they come down to my office to read me a book. I have lunch with my kids every day. I'm available for my wife when she needs me.
I don't know if that's the kind of answer you were looking for, but I think it's important. Some people seem to use success in their career to reinvest in their career further to achieve more career success. At some point the career seems to exist as an end in itself, and not just a means to have more of what you want out of life.
For me, my career success enables me to spend more time working on the relationships that matter most to me. So in that way, being a developer, educator, and entrepreneur has enabled me to spend time practicing being a better father and husband.
I haven't really thought this through in a way to teach it to an absolute beginner. I think there are a lot of concepts I would need to teach an absolute beginner before we got to classes and inheritance. But the way I think about it is that if you want this thing to have the behavior of the parent, then you need to give the parent all the information it needs to do its job, which is why you call
I don't think I've explained that very well. I think I'd need to write a blog post or make a video to explain it adequately. Eventually I do plan to target more content toward beginner programmers. :)
What things you considered before going solo? Or rephrasing it. What were the things one should take care first before going a solo consultant?
The most important thing that my wife and I needed before going solo was to know that we had a safety net in case things didn't work out. So having some good companies that I know would give me a chance at an interview if I needed to get a regular job was important. Also reducing and eliminating debt and having a good amount of savings around. And the fact that I had worked the last 4 years on the side to develop a passive income also really helped ease our concern that this wasn't going to work out, or I wouldn't have time to build up something and start earning money.
How do ensure deliberate practice when it comes to code practice.
This is a good question. I like to consider the kinds of things that I want to learn and focus my coding on those specific things. I really like to practice in isolated environments so I can focus. So using things like codesandbox.io is really helpful. Good luck!
Hey Kent! Much appreciation for everything you've done for the community. I love your testing course. With regards to creating tutorials, what's your advice for
1) identifying the concepts people struggle to understand the most (without a big following yet),
2) creating the most effective way to explain the concept, and
3) exploring business models to facilitate being a full time educator like yourself?
Bonus question: I'm more interested in teaching people than actually writing code for a company, but I feel like I need to "do my time" in order to establish credibility and know what I'm talking about. What's your advice here? :)
Thanks again! Josh
1) StackOverflow can help. Also, take a look at what people are asking others who do have a big following. You can search for mentions of that user and you'll find questions. Add a "?" to the search. Like this: twitter.com/search?q=to%3Akentcdodds%20%3F&..
2) This is something that comes with practice, but maybe this post will help How I Teach
3) I never really explored business models to be honest 😬 I know it's not very helpful, but egghead just kinda fell into my lap. You can read more about that story from my 2010s decade in review.
I wouldn't see working in industry as a "do my time" proposition. It's an incredibly great and very important learning experience. You can't pretend to teach people how to build production applications if you've never done that yourself. When you're a teacher you actually spend most of your time learning. You become a professional learner and you'll really need that time you've spend learning what it's like to build and ship production applications in the real world. Eventually I plan to build and ship something again to re-vamp my skills and stay sharp.
Hi Kent, I am looking for a change from PHP to some other trending technologies. I have started studying Go programming. Am I going through the right path to have a better career?
Hi Kent, I have tweeted this question: How to deal with testing UI components where styles have to be verified? I'm completely against checking classes of a DOM node. Would you recommend checking styles instead?
Say a button component is to be tested. Like bootstrap, lets say, there are N variants of button based on the props passed viz. primary, alert, info... How about testing this? Can you please more insights on this?
Styles are all about the way the component looks. You can't test that reliably without visual regression testing tools. So if you need confidence that the look of your components remains unchanged, I recommend you take a look Applitools or Percy. Good luck!
What is a good way to distinguish myself as a coder from the hundreds of other boot campers and college graduates?
Welcome to the career of coding! One thing you can do is get involved in open source (kcd.im/what-oss) and starting blogging regularly. Good luck!
What are the main concepts of React?
I'm actually working on an update to The Beginner's Guide to React right now, so this is on my mind a lot recently. The main concepts I teach in there are: React elements, JSX, custom function components, event handling, state, and side-effects. That's pretty much it.
What would be your general advice for improving the performance of a Node app? Are there any patterns/antipatterns that come to your mind?
When I was at PayPal I worked on our Node app, but I never worked on performance issues myself, so I have limited knowledge to give you around performance and node. What I would say is make sure you have good monitoring in place so you can be made aware of performance issues and ensure you're optimizing the codepaths that are actually slow and don't just seem like they might be slow to you when you look at the code. Good luck!
Hey Kent! Thanks for this QA. I just want to know, Should we keep our frontend & backend in separate repos or in same repo? What are some good practices? And what is your recommendation? Thanks.
When I was at PayPal, we combined the frontend and backend into a single repo. Mostly because our backend rendered the frontend. We were exploring separating them when I was there, but I left before anyone did that in a substantial way.
There are a lot of trade-offs here. If I had to make a decision about this right now, I'd probably keep them together. Separating them feels like a pre-mature optimization to me. Wait until it's painful to keep them together, then move them at that time.
Hey Kent! Huge fan of your work. What is the latest project/ side-project you are working on & what is your go-to tech stack and why (we can guess the frontend ;) )?
The biggest project I'm working on right now is actually my website. Tools used include:
- Gatsby (React, reach router)
- Netlify Serverless Functions
- ummm... that's basically it 🤷♂️
Granted, it's not a super complex app. I would say other tools I would recommend include Reach UI, and I'd probably recommend React Router v6 (in beta now) over reach router. Also, I'm getting excited about react-query, xstate, and tailwind. Good luck!
I am web developer with a special crush on blockchain technology and having affairs with node.js and react.js.
Thanks for the AMA
Do we need integration testing when we have e2e already?
E2E will run and pass only when its properly integrated with the packages, right!
That's a good question. The answer is yes. I have a blog post that should help: Static vs Unit vs Integration vs E2E Testing for Frontend Apps. Good luck!