28: Be Healthy and Love Gatsby with Jason Lengstorf
Jason Lengstorf is a developer advocate at Gatsby and productivity speaker/author. Chantastic asks about what the Gatsby team is up to, why Gatsby makes sense, and how their team is growing a vibrant JavaScript community. They talk about GraphQL, why there’s no site that couldn’t be static assets, connecting Gatsby to your existing API, and productivity tips for staying fresh and capable at work.
Featuring
Links
- Site: Gatsby Docs
- Site: Gatsby Community Page
- Tool: Lighthouse Chrome Extension
- Tool: webpagetest.org
- Video: How I Cut My Working Hours in Half and Somehow Managed to Get More Done
- Article: The Multitasking Myth
- Book: It Doesn't Have to Be Crazy at Work
- Book: The One Thing
Transcript
[00:00:00] Michael Chan: This is React Podcast. I'm Chantastic. Today I'm joined by Jason Lengstorf, incredible speaker, amazing developer, and currently developer advocate for Gatsby. It's no secret that I love Gatsby, so I had to get him on to talk about what's new in version 2, how people can contribute and find success using Gatsby. Now, Jason's also a productivity buff with some amazing talks. So, we dive into that at the second half of the episode. I think you'll find what he has to say incredibly valuable. Let's dive into the show. First, a word from our sponsor. This episode of React Podcast is brought to you by React Training. They provide in-person, hands-on training for development teams. From community leaders and experts. For more information, visit reacttraining.com. Jason, welcome to the show.
[00:01:13] Jason Lengstorf: Hey, happy to be here. Thanks for having me.
[00:01:15] Michael Chan: I am super excited for all the things that we could talk about. I'm gonna do my best to make sure that we keep it, you know, to our regular 40-ish minutes and not have like a 3-hour conversation, 'cause I know you got things to do and, you know, people got Their commutes aren't that long. So, um, first of all, I just wanted to get a sense of who you are. For anyone who is listening and um doesn't know who you are, what's the what's the high level on you?
[00:01:40] Jason Lengstorf: Uh, the high level on me is that I am working in developer relations at Gatsby. Um, Gatsby is a React framework for building high-performance websites. Um, I've been doing DevRel there since about March. Uh, prior to that, I worked as a front-end architect at IBM for a while. And prior to that, I used to run an agency, do some freelance stuff. That kind of fun thing. Outside of that, I don't know. I guess that's really my whole identity.
[00:02:08] Michael Chan: You know, jobs have a way of doing that to us, right?
[00:02:13] Jason Lengstorf: It's absolutely true.
[00:02:16] Michael Chan: So how big is the team at Gatsby right now?
[00:02:18] Jason Lengstorf: We are at 15 and growing kind of- not growing aggressively, but uh I think that that's on the horizon here, assuming all goes well.
[00:02:30] Michael Chan: What are the big um big things that you're looking forward to and building out in the Gatsby community?
[00:02:35] Jason Lengstorf: Um so we're we're working on a couple things that I'm really proud of. So you know I work in in developer relations, which means that like the the area of Gatsby that I own is uh community. Like my that's my direct responsibility.
[00:02:48] Michael Chan: Awesome.
[00:02:49] Jason Lengstorf: Got um Amberly Romo, who is uh a wonderful developer, getting people up and running with Easy PRs, good first issues, a really good way to onboard first-time contributors. And then we've also got uh Shannon Soper, who is leading our docs effort. She's like standing up docs issues and people are just knocking those down. Uh we've got Dustin Schau on our open source team helping uh make the core issues more accessible to people because, you know, Gatsby is a complicated piece of software, right? So to get into the guts of it, you need to have a lot of context. So Dustin is doing a great job. Of pointing to the right places to get that context so that you don't need to know all of Gatsby to fix this one issue. Um, that's one that I'm really excited about. We're expanding our swag program. So we um, we will give anybody who contributes to Gatsby uh free swag. That's something that we do to just, you know, say thank you for being part of the community and to show appreciation for the people who are willing to put their time into making Gatsby a better place. Uh, so we've got, you know, t-shirts, socks, things like that. But now we're adding more higher value swag, right? So we're gonna- Awesome. Gonna get some uh some like vacuum-sealed uh travel mugs. We're gonna get hoodies. We're gonna get— uh we've got lapel pins coming in. And then my this is so this one's my favorite. We are getting uh what we're calling freelance pants, uh which are actually just pajama pants. And so we've got we've got two uh two prints of pajama pants, one that's like very businessy. It's like black with a with a dark gray logo on it. And then we've got one that's way more fun that's this uh this like bright purple pattern that's got the Gatsby logo and the GraphQL logo and the React logo all kind of like hand-drawn on there. Um so they're really silly, really fun. That's probably— and and like so Marissa Morby, uh our our product manager, she came up with the name for Freelance Pants, and I— Oh,
[00:04:43] Michael Chan: that's amazing. —am
[00:04:44] Jason Lengstorf: just absolutely in love with it. They're uh—
[00:04:46] Michael Chan: Please tell me you own like the .com and the Twitter and all that kind of stuff for that.
[00:04:50] Jason Lengstorf: Oh, OK. I'm gonna have I'm gonna have to buy that before this airs.
[00:04:53] Michael Chan: You got to beat me. I'm on there right now. Do you have to contribute at a certain level? Like are those for like really big projects? How does that work?
[00:05:02] Jason Lengstorf: Yeah. So the the um any contribution, like even a typo fix, will get you a T-shirt or socks or uh or stickers or or whatever. Um for the higher value items, what we're doing is we're looking at at number of contributions. And so there's not really any limit on that. Like we we don't want we don't want to become gatekeepers of what's acceptable, right? We just want people to participate. And so for us, like, any 5 contributions, cool. You get a hoodie. You get a uh uh mug, whatever you want. Um and then we also, we just sell them, like, at cost, right? So, you know, for from our standpoint, we we want people to have access to this stuff. And like, we don't look at swag as a revenue source. Like, we foot the bill on shipping and stuff too, right? So it's for us, it's, you know, it it's no matter where you are in the world, we're gonna send you swag. We're not gonna charge you for shipping. We're only gonna charge you the cost to produce the thing. Or if you do stuff on the repo, we're just gonna send you the thing for free. So, you know, we we really want more people involved in the community that way.
[00:05:58] Michael Chan: How did that practice start? Because it seems like a really big part of the community. Like every day I'm seeing tons of tweets about people getting their swag and they're super excited about it. And it feels very warm and friendly. Um, what was the idea, the inspiration behind that?
[00:06:13] Jason Lengstorf: So when Gatsby got funding, right, so we're venture-backed now. And we started looking at, like, okay, so how do we make sure that as a venture-backed company we don't alienate the community? Um, because, you know, it's really easy if you do it that way. Like, okay, we're now a company, we need to make money, we're about business metrics. And all of those things are true. But Gatsby is an open source project. And open source is built on the community. And so, the most important part of Gatsby succeeding as a company is that we don't alienate our community. So the swag project is kind of a- it's our way of of trying to send a really strong signal that the most important thing to us is the community. That's also why we offer like free pair programming. So anybody who wants to in the community can sign up for an hour and one of the core Gatsby team members will pair up with you through a video call to work on any project you want. Uh I've been doing open hours. So I'm in Portland, Oregon. And once a month I've just been going to a coffee shop and I just work there for a few hours. And anybody who wants to can come by. And I'll help you on your projects. Um, so we're trying to kind of expand this effort a little bit. We're trying to get more people- we open-sourced our workshop format so that anybody in the community can then take our workshop and go and give it. You don't have to write a workshop. You just have to show up and follow the instructions. So that, you know, it's easier for people to get involved, to build their resume, to to kind of use Gatsby as a way of building your career, right? Like we want you to be a stronger developer because- By making you better, you make our community better. And you know, that's that's the best outcome for everybody.
[00:07:48] Michael Chan: This is something I've seen a lot, the value of out-teaching your competition to to give people the opportunity to succeed using your platform and making sure that they feel like they have the tools to be successful. It seems like that that culture of sharing is becoming more and more popular, more and more valuable. A great way to kind of market a product by also supporting the the industry and the people who are are using it.
[00:08:16] Jason Lengstorf: One of the things that bothers me the most about, like, when people talk about companies as as like capitalist entities, right? And I'm not gonna get political. I know I just said capitalism. But um what I what I see is a lot of times people mistake capitalism for like only profit, right? Like the but the goal of these companies is to get the best Like, the most value. And the way that you get the most value is by building the best community, because the best community is going to go out and sell for you. They're gonna they're gonna help you expand your community, get you more customers. Yeah. They're going to be happier, which means they stay longer. They become loyal. Like, if you focus on your community, that's just good business. And I and I've never understood companies who think that, like, "Hey, let's you know sponsor an event for our community." They're like, "Oh, that's a waste of money." I'm like, "Are you crazy? That's the best that's the best use of your money." Like, get back to your community constantly. Because every single company that does it, you see that value. You know, the the people who get deeply invested in brands, they don't do it because the company is like, hey, look at this great thing. They do it because the company is is really investing in their community. Um, and I and I just I just I can't really imagine how companies don't see the value in that.
[00:09:28] Michael Chan: So if someone is looking to contribute to Gatsby, what's the best way for them to start? Like where's the best place for them to get a foothold? And kind of go from there.
[00:09:36] Jason Lengstorf: We have a really good contributing section in our docs, which links to all the different ways that you can become a contributor. So we we don't just ask for code contributions. We have, you know, obvious ones like docs and less obvious ones like give a talk on Gatsby. Um, you know, add a site to our site showcase or, you know, things things like that that may not seem like actual contributions to Gatsby, But that from our our perspective are absolutely contributions. Like community events are a contribution to Gatsby. So um there are lots of ideas there for ways that you can get involved. And we also have links to different lists of issues that have been curated for like this is a good first issue or this is you know this is a documentation issue, that kind of stuff.
[00:10:21] Michael Chan: Okay. And where do people find that repository?
[00:10:24] Jason Lengstorf: It's uh it's on gatsbyjs.org um in the docs section. Uh down at the bottom of the the docs sidebar, there's a whole section on contributing with uh with details on the swag program, details on how to get started, and all that good stuff.
[00:10:38] Michael Chan: Cool, cool. And we'll link that in the show notes so you can you can go right there. Let's talk about a little bit about the actual tech. Yeah. At its core, Gatsby is a static site generator. But that's not 100% true. Um it seems to be significantly more than the static site generators that we've used in other languages. Maybe like Jekyll in Ruby or- I can't remember the Go one. But but static site generators like that. Um can you speak a little bit more to like what makes Gatsby special?
[00:11:10] Jason Lengstorf: Yeah. So, um so to be clear, like the stuff that Gatsby does is stuff that you can do with any static site generator. The difference is is that Gatsby focuses on it. And so it's a it's a primary objective for us. And what we do is, um, we do generate static assets, but typically what that means with something like, say, Jekyll, Jekyll's gonna compile down to static assets that are are HTML and CSS. Um, and maybe if you write custom JavaScript, there will be JavaScript. Um, what Gatsby's doing is it's compiling down to HTML and CSS, and then once the page loads, it rehydrates. To a React app. And so what that means for the the developer is that you're building static assets, but you're not actually sacrificing any of the dynamic capabilities of of using React. So you can make asynchronous data calls. You can have lots of user interactions. You could you can uh set client-only routes so you can handle things like authentication. Mm-hmm. We, for example, our Swag Store is a Gatsby app. Um, we build the products at build time. So we pull the product data down and build the site and it's got products. But then the the cart interactions and the user authentication, that's all handled dynamically at runtime. So to do that in something like Hugo, you definitely can. But you you're then responsible for building the React app, injecting that React app into the Hugo templates, and then kind of managing it that way. Um, whereas with Gatsby, the React app is the static site generator. Got it. So that's the primary difference. And and it's also one of the reasons that you might not need it. If you're just building static sites and you don't need any of that that dynamism or or just you're not a React developer, like you may not need it. Like sometimes it is overkill. But you know the benefits that you're gonna get are we really focus on keeping that dynamism there. We really focus on performance. Um and we we focus on giving you a really, really friendly developer experience. So for JavaScript developers, as far as in my uh obviously biased opinion, um the the developer experience for a JavaScript developer using Gatsby is going to be superior to any of the other um any of the other static site generators out there. Because either they're not written in JavaScript or they're they're designed more from a like do-it-yourself perspective. And they're definitely There are exceptions to that. Like, you know, React Static is really, really good. Don't get me wrong. Um, you know, it just- when you hit the edges, when you hit the edge cases, you hit them pretty hard.
[00:13:52] Michael Chan: That makes sense. I'd never heard it put quite like that. But basically, you can think about this static site as a dynamic site from the beginning. Like from the very first line of code that you write.
[00:14:01] Jason Lengstorf: Exactly.
[00:14:02] Michael Chan: That's awesome. Um, so tell me, what are the core technologies that that you interact with when you're building a Gatsby site?
[00:14:10] Jason Lengstorf: Um, so the the core technologies are gonna be React and GraphQL. Um, and then your your CSS library of choice. What what you'll never have to think about, which is what I think makes Gatsby wonderful, is you don't ever have to set up your build process. So things like Webpack and um, so your Webpack setup, your Babel setup, your your build process, that's all abstracted away inside of Gatsby. Uh, for advanced developers, we have escape hatches where you can get to those configuration files and change them. Um, but for for most people, it's not something you need to do. You typically won't ever have a reason to go in there unless you're doing something really uh special. So when you when you make those those changes, you're gonna open up a editor. Like you're gonna use the Gatsby CLI to generate a new site. Open up the index page and edit it, and it'll live update on the. Got it. The internet or on your browser instantly. Like no setup step whatsoever. Um, and then, yeah, so React and GraphQL are gonna be your your primary building blocks.
[00:15:15] Michael Chan: Now, you had mentioned um that the Gatsby store is powered by by Gatsby and then the checkout, the cart process, um is all dynamic. Um, is that site open sourced or do you have an example of how someone might be able to do that?
[00:15:31] Jason Lengstorf: Yeah, the the whole store is open sourced. Awesome. And we have uh a couple examples in our uh our core repo, in the Gatsby repo on GitHub. Um there's an examples folder that has like a simple auth example and a dynamic routes example so that you can you can see reduced examples of how to make that stuff work. Um but yeah, the the store is probably the canonical example right now of building a a really dynamic app.
[00:15:56] Michael Chan: Yeah. This is this is one thing that I'm super excited about, just seeing this space evolve where you have an app that is like fully built down into static assets but is capable of doing anything that you would do on like a regular database-driven, like traditional, like kind of like Rails or Node site.
[00:16:15] Jason Lengstorf: Mm-hmm. Yeah, this is so this is something that like I I feel like ultimately this is gonna be the hill that I die on, is that there's there is no such thing as a web app that couldn't be static assets. Um, yeah. Because what I've been finding is that every single website is like HTML and CSS and a little bit of JavaScript that is built from data. And that data is either going to come in through the server that's also serving your HTML and CSS and JavaScript, or it's gonna come from an API. And functionally, those are equivalent. It's just an organizational thing. So as a company, you can almost- like I I have yet to find a good reason not to make your UI an open source example of how to use your APIs. Interesting. Because it's the, you know, like if you if you think about a company like— uh like this was this was one of the reasons that I ended up not sticking around at IBM is that I was making this argument. Um but like IBM Cloud is a cloud services provider. So they're they're spinning up object storage and um you know like databases and all these things. All that's done through microservices that are API-based. So the UI of IBM Cloud is just making API calls and displaying that data. And so, if you if you think about it that way, the best possible example you could have of how to use your APIs would be open sourcing your UI, right?
[00:17:39] Michael Chan: Yeah, absolutely.
[00:17:40] Jason Lengstorf: So anyways, I I I kept making that case and people kept agreeing with me and nothing happened. So that was why I ultimately ended up going to Gatsby. I was like, we should build a Gatsby site. And they were like, they were like, yeah, yeah, yeah, someday, someday. And then I got on a call with Kyle uh Kyle Matthews, the founder of Gatsby. And I was like, well, I want to do all these things. He's like, you sound super frustrated. Do you want to come work for me?
[00:18:00] Michael Chan: Smart man. Smart man. Get them while they're in pain, right? That's awesome. So, um, what is the performance out of the box of a Gatsby site? I know some big topics right now are performance and um accessibility and Lighthouse scores and all that kind of stuff. Um, what do you get for free? Just by using the Gatsby CLI?
[00:18:29] Jason Lengstorf: Um, if you use the Gatsby CLI to build a site using our default Gatsby starter, uh, which would be if you have the Gatsby CLI installed, like gatsby new and the name of my site, we'll build a Gatsby site for you. That will get uh straight 100% on uh webpagetest.org and in Lighthouse. And the the reason is that under the hood, we're doing code splitting, we're doing image optimizations, we're doing lazy loading of assets, we're doing background prefetching, um, we are installing the service workers. Worker and offline support. So we're we're kind of ticking all the performance boxes by default. Yeah. And then you as a developer- I feel like we're inverting the paradigm, right? So instead of saying here's a blank slate, make something excellent and also take all these considerations for performance and and so on, we're saying here's a website that's done. Like all of the boxes are checked. All you have to do is make it beautiful. Yeah. And that's that's kind of the the approach we want to take with with Gatsby in general. Is like it's done when you start. You all you have to do is change some content. Um and and we think that this is this is the way that ultimately we we push the web forward, right? Is is if we make— we're we're trying to make the right thing the easy thing. That's kind of a mantra of mine. Is um is if you if you look at what the behavior you want people to follow is, like Making websites accessible. Making, you know, we just installed Reach Router instead of React Router on Gatsby because it's accessible by default. So now developers don't have to think about accessibility. It just happens. All they have to do is not break it instead of implementing it in the first place. And so, you know, we we always try to make those decisions. How can we make the best decision for the user, the easy decision for the developer?
[00:20:12] Michael Chan: Are there places in the sites that you're seeing built that people typically or regularly opt out of the the defaults? Or is it pretty easy to not have to go that deep into the guts? Like is everything kind of exposed at a level that most people can kind of just start and have everything they need to go, but also enough room on the back end to kind of like push back a little bit?
[00:20:36] Jason Lengstorf: Typically speaking, people don't need to make changes to the underlying code in Gatsby. Uh, where we find it happening is people who want to use like the latest and greatest whatever, um, they need to like eject our Babel config so they can put in plugins to get you know whatever the new feature is. Or people will want to put in special handling in Webpack for for a thing that they want to use. And so they have to like add, um, they have to add loaders in Webpack. But typically speaking- Gotcha. Like for the the the most average use cases, like I'm gonna build an app, I want to use Emotion or Glamour or CSS modules, I want to have like fast loading images. We've got plugins for all that. It it handles all that for you. So you should very rarely find yourself needing to get off the the beaten path. Um it's just you know it's it's basically like you want to you want to go uh like pioneering and and build something brand new, then absolutely, yeah. But you know like I said, we we've got APIs that just inject that config for you.
[00:21:40] Michael Chan: Very cool. Now I know there's some kind of tension for a lot of people in using GraphQL as the way that you interface with the the file system? And what kind of guided that decision? And what's the big win there?
[00:21:55] Jason Lengstorf: A a great way of thinking about this is um if you think about what you would have to do with a REST API to make a series of calls. So let's say that you have uh authors on your on your blog. And it's a code blog. So when you have your authors, you also want to pull down maybe their most popular 3 repos from GitHub.
[00:22:17] Michael Chan: Okay.
[00:22:18] Jason Lengstorf: So to do that in a a REST way, you would have to make a REST call to your blog database to get the author data. And then you would have to use that author data to make a REST call to GitHub's API to get back the repos. And then you would have to manually combine that data into one object so that you could then pass it to your your React components and display it. Um, in GraphQL, all of that data mapping gets done ahead of time. So what we'll do is we'll take the blog authors and then you use the GitHub plugin and we know to map like this data to that data so that you can just say, okay, give me this blog's author and go into their GitHub and get the top 3 repos. And then you just get a JSON object back with all that data. And you can just display it, right? So you you don't have to make 2 REST calls. You don't have to do that. And you can imagine this gets significantly more complex, right? Like if you're looking at um like a normalized REST API, you typically are only gonna get back lists of IDs for things. So you've got your post, and then your comments are gonna be a list of comment IDs. So then you have to make a REST call for each one of those comments to load the comment data. And then the comment data is gonna have a list of author IDs. And so now you're going deeper and deeper and deeper. And you know, you end up with like these nested chains. And and the other problem, too, is those have to be synchronous, right? Because you can't make the comment call until you have the post data. And so, then you have these like synchronous chains of of data, which slows down your app. So with GraphQL, we can do all of that ahead of time and we can combine all that data into a single API. Um, and there's been a ton of work that we didn't do on how to how to optimize those queries, how to cache things when they come in, how to make sure that we're not duplicating REST calls, and to like make this as efficient as possible so that you're getting performance benefits for it. You're also getting an easier API. You can open up GraphiQL in your browser. And GraphiQL is a GraphQL kind of GUI where you open up a tab in your browser that gives you a field where you can write GraphQL queries. And on the right-hand side, there's docs that will show you every single field in your GraphQL dataset so that you can just look at them, write them down, and then hit play and see the data come back in real time. And when that's done, you can literally copy-paste your GraphQL query out of GraphiQL and into your UI and get that exact same data. So it's a- the way that I always explain GraphQL to people is that you're gonna hate it until you've used it for half a project, and then you'll never not use GraphQL. Because the the learning curve is very steep, but it's very short.
[00:24:55] Michael Chan: Yeah, I I completely agree. So I I have written a number of Jekyll sites, and I remember when I am writing those Jekyll sites, I am on the docs a lot. Like I have Jekyll docs open to know how to get this data from this certain thing that does the thing that I need.
[00:25:11] Jason Lengstorf: Mm-hmm.
[00:25:12] Michael Chan: But I feel like that flips a lot using Gatsby where I'm on my own site. I'm just looking at that GraphQL server, navigating the navigating the data in my app by clicking the documentation that's generated by this app that I'm making. Which is a totally different shift. And it's
[00:25:31] Jason Lengstorf: Yeah, I um I feel like that was one of the bigger changes I've seen on a team. I uh we we rolled out GraphQL at IBM. That was like my one big accomplishment, was pushing GraphQL into IBM Cloud. And we we saw frontend teams, every single frontend team was like, no, we don't want to change. And then we we convinced them to try it. And they'd get about 2 weeks into the project, and then they would be so excited about it that other teams started coming to us. And saying, hey, we heard that you're doing this thing. It sounds awesome. Can we get in on this? So it was like- I've said it before, GraphQL is one of the more exciting developments in tech that I've seen in a long time. Yeah. Because it's one of the first ones where I see developers opting in to change. Like developers who don't want change. Like it it removes so many pain points of trying to manage all these disparate REST APIs and trying to understand, you know, are these docs up to date? Do I have all the things that I need? What do I need to do? Instead, you just open a browser tab and just click around. And all of a sudden, all that data is accessible and you can just do stuff. And we're not even getting into the advanced capabilities like data mocking and and you know these these really, really powerful things that allow you to do things like develop offline without having to mock your entire API. You just get like dummy data so you can build things. It's it's really incredible.
[00:26:48] Michael Chan: So if someone has a REST API right now and they want to build a Gatsby frontend that takes advantage of that API, do they have to build a GraphQL server as like an intermediate? Or are there ways to um use Gatsby with the existing API?
[00:27:03] Jason Lengstorf: Uh yeah, so we have we have a a pattern that we call source plugins. And so, a source plugin will just make a call to your REST API and then you use one of our API calls and we'll turn it into a GraphQL API. Oh, cool. So you so you don't you don't have to do it as a developer. You just have to tell us what you want changed. Mm-hmm. You can also, depending on where you're loading your data, like there's nothing that stops you from making those REST API calls in a Gatsby site. Uh for example, if you look at our store, there's a on the account page, we request a discount code through a REST API. So that's an asynchronous call to a REST API, no GraphQL in sight. Um and so there's there there are options for sure. There's no restrictions on what you can do with it. There are just there are ways that will make your life easier in the long run. Um, so, you know, if you have data that's mostly static and should only change on rebuild, probably take the time to build a source plugin because it's ultimately gonna make your performance that much better.
[00:28:01] Michael Chan: Is there anything else that you want to say with regard to Gatsby? We have a little bit of time and I really want to dive into you and some of your advice to developers in general.
[00:28:09] Jason Lengstorf: As far as Gatsby goes, I I love to talk about it. So if anybody wants to reach out to me on Twitter, I will um I will talk about this with you until the cows come home. So just uh just reach out to me.
[00:28:19] Michael Chan: Awesome. And what's your Twitter? We'll link it, but what's your Twitter since we're talking about it right now?
[00:28:23] Jason Lengstorf: Good luck spelling it. It's @jlangsdorf.
[00:28:26] Michael Chan: And you were telling me an interesting story before we started recording, um that you're like the only Lengstorf that is online right now.
[00:28:36] Jason Lengstorf: Yeah. So my my family at some point in the past like misspelled their own last name. So So, so I'm the only Jason Lengstorf in the world, uh which means that my SEO is like on point.
[00:28:50] Michael Chan: I want to talk a little bit about um some talks that you've done recently. Uh right on the front of your site, there's a big image that says there's more to life than hustle and grind. I know that grinding is a very kind of valued characteristic of of humans and developers right now. So why do you think that there's more to life? What does that statement mean for you?
[00:29:17] Jason Lengstorf: We took this idea of like hard work will get you anything you want. Um, which is a very kind of American dream sort of way, you know, like all it takes is a little like grit and and elbow grease and and you can get anything you want in this world. And I do agree with that. And I do agree that people need to put the work in. I think Where this somehow flipped over, though, is we lost sight of the fact that, like, working hard is only effective if you are, like, fresh and, like, capable of doing good work. Yeah. Um, and so we- at some point, we, like, lost sight of that, and the value became work until you're dead. You know, like, grind yourself to paste. Yeah. As opposed to, you know, work hard and then recharge.
[00:30:06] Michael Chan: Yeah.
[00:30:07] Jason Lengstorf: So from my perspective, you know, I I I fell really deep into this uh back in the the early 2010s, where I was working, you know, 70, 90-hour weeks and, you know, just really burning myself to the ground as far as as effort level went. And, you know, I was just never off. I was always connected, always checking my email, always trying to knock one last thing out. And I ultimately, like, I got myself so stressed out and so wrapped up in my work that uh my my beard started falling out of my head. Like I um it it I never got like an official diagnosis for this, so this is very like WebMD diagnosis, but what I'm pretty sure I did is I gave myself stress-induced alopecia. And for a few years, like 2 or 3 years, I couldn't grow a beard. I could I the whole bottom of my chin was just like baby smooth and bald and it would not grow any whiskers whatsoever. Stop it.
[00:31:00] Michael Chan: And and for those just listening, you have a you have a glorious full beard now.
[00:31:04] Jason Lengstorf: Yeah, the the joke is that, like, I so I look so bad without a beard. Like, I I look I look like a like a puffy baby that had a really long night and was like, you know, not taking care of himself. Um, and so uh my option was to look like that, like, chubby baby or to grow a mustache. And like, I am so appalled by the way I look clean-shaven that I wore a mustache for 3 years to try to to try to avoid being clean-shaven. Um, but so anyway-
[00:31:38] Michael Chan: It's like a chubby baby dressed up as a cop for Halloween or something.
[00:31:42] Jason Lengstorf: Yeah, exactly, right? So, uh, yeah, it was like uh it was like baby P.I. Um, but uh but so then what ended up happening was, like, at some point I just hit the wall, and it was it was burnout to a level that I've never experienced before, where I it was it It was like nihilism. Like full nihilism. Like nothing matters. This career is meaningless. Like I I am clearly just making myself miserable and I'm gonna die. So screw it. I don't care. And so I just like set these really, really strict rules where I was like, you know what? From 6:00 PM to 8:00 AM, nothing is going to beep. Uh I deleted email off my phone. I turned on these like app trackers that would basically disable things after certain times. It was really, really aggressive about just not being my work. I was like, "You know what? My job is just a job." And I and I I thought about it, like- I used to fantasize, in the worst of this, about quitting tech to go work somewhere like as a barback or like in a convenience store, where when you clocked out for the day, like that was it. You just went home. Nobody's gonna call you to be like, "Hey, is the convenience store OK?" Like, "I don't know. It's closed, man. I don't- You don't pay me enough to care about what the convenience store is doing when I'm not here, right?" Yeah. Um, yeah. And so I figured instead of like trying to change industries and finding- 'cause every industry has its demons, right? So I was like, "Instead, I'm just going to treat this job as if it were a like a job at a convenience store or a job at a bar. Like, when I leave, I'm done. You can't reach me." Um, and I I I got healthy again. My my mental health went back up. My beard grew back. Like, I just I just felt- Immensely better. Um, and what I expected to happen was my my business would fall apart, and what actually ended up happening was like it got better. Because I wasn't exhausted all the time, because I wasn't sleeping 3 hours a night. And like, you know, there's some science that says basically if you if you only sleep 6 hours or less a night, you uh you get so exhausted, like cumulative exhaustion, to where your error rate goes up and you spend more time fixing errors that you wouldn't have created in the first place, then like it makes you negatively productive versus just working a standard schedule and getting enough sleep. Um, and so, you know, there's all these things that I didn't know that I found out after the fact that basically mean, like, just work your 40 hours. They did a lot of research to figure out that 40 hours is like the human max. Um, yeah. Get your 8 hours of sleep, you know, like take care of yourself, because that is how you grind. Like if you wanna get a lot done, Be healthy. Like, be be actually healthy. Take walks. Be disconnected from your phone. Have weekends off. Like, be a person outside of work, and it's gonna make you a better lateral thinker, it's gonna make you a better worker in general, you're gonna have more energy to do the work when you're doing it, you'll make fewer errors. Like, all of these things that don't seem obvious when you're in the thick of it. You're like, "Well, no, I just need to do 2 more hours because I gotta get this thing done." Disconnecting is like the worst possible thing, right? Like, I can't walk away from this now. But every single time that I've done it, I I'm like, I I gotta finish this. Well, hold on, I've been working like 8.5 hours, I should stop. So I stop, I go to bed, I come in the next day and I solve that problem in like 10 minutes because I was overtired. My brain wasn't working anymore.
[00:35:01] Michael Chan: That is um one thing that I really enjoyed listening to some of your talks was I I had never heard that that 40-hour work week was as a result of a study to basically maximize human effort. How do we minimize errors, maximize effort? Like, what's the amount of time that people can work before we start paying for it more with errors than in hours that we gain?
[00:35:24] Jason Lengstorf: Yeah, and that study was made during the Industrial Revolution, right? That was Henry Ford on the assembly line who came up with the 40-hour work week. So the likelihood that it's perfectly accurate for for knowledge workers is low. Sure. But I would make an argument that it's probably it's probably erring on the side of too long rather than too short. Um, 'cause I I don't know about you, but like if if I sit down and I put in 6 solid hours of effort, I'm done. And if I if I pan that out over a week, that means I have about a 30-hour workweek of high focus. Um, and typically I fill the rest of that time with meetings, email, Twitter, you know, stuff that is ostensibly productive, but typically if I didn't do that work, the world would probably continue. But yeah, I don't know.
[00:36:08] Michael Chan: I had a sabbatical at my company for the month of September.
[00:36:12] Jason Lengstorf: Oh, nice.
[00:36:13] Michael Chan: Oh man, it was glorious. I loved every second of it. But I do have that kind of natural drive. I think a lot of us do. And you know, so what happens is we we we end our 8-hour workdays, like even if we're diligent about that, then we go and we do like open source or we like kind of have some other grind that we're we're working towards. So I I kept that up, but man, just having like 4-hour days where I have a slow cup of coffee in the morning and then I sit at my computer and do some, you know, open source or work on a talk for, you know, like a handful hours and then move on with my day. It was just, it was beautiful. It was, I was like, man, 4 hours is about my my sweet spot, I think.
[00:36:52] Jason Lengstorf: I've been finding that's true for a lot of people. Like I I have a friend of mine who works as a writer. And if he works longer than 5 hours, he throws away everything after that anyways.
[00:37:01] Michael Chan: Yeah.
[00:37:01] Jason Lengstorf: Um, and so he just knows. Like, he puts in 2 solid hours in the morning, and then he takes a long lunch and like a walk and thinks about stuff, gets a workout in, and then he comes in and puts in 3 hours in the afternoon, and then he's just done. And he's as productive as anybody else I know. And and if you read back about a lot of the really creative people, like— um, and I'm of course drawing blanks on names, but I think it was like Like Beethoven and, uh, and like these very- these people who you would think were like workaholics, they worked like zero hours. They worked like 3, 4 hours a day, you know? But the time that they worked, they were like on point. They were 100% focused, in the flow, pushing really, really, really hard to improve whatever it was they were doing. And then the rest of their time they spent learning, um, you know, getting inspired from other places, being with people and friends. And I think, you know, that that's something that gets highly undervalued. Um, and so that, you know, that the times that I do the 4-hour workday, I feel awesome. Um, and I also don't feel like my productivity suffers all that much.
[00:38:05] Michael Chan: DHH and Jason Fried just came out with a book called "It Doesn't Have to Be Crazy at Work." And I just started reading it and you just reminded me, um, through through the book they have illustrations of these famous thinkers and they talk about their schedule and they're like, "Oh, yeah, so-and-so worked like 4 or 5 hours a day, like max." That actually
[00:38:26] Jason Lengstorf: may have been where I saw that.
[00:38:28] Michael Chan: Yeah, it was it was really amazing and like really inspiring, too, to think not just about hard hours, but the quality of your hours. And that's what I have really enjoyed about your talks.
[00:38:38] Jason Lengstorf: Yeah, there's a a book called Flow that's extremely good for for kind of talking about that general concept. Um, there's a... Just a huge body of research around like the quality of things and and just the the necessity of being not distracted at certain points. And and uh so like not distracted at work, but also not distracted when you're bored. There's another a great book called Bored and Brilliant that just talks about like, hey, when you are out with your friends, leave your phone in the car. Yeah. Or if you go on a walk, like don't watch YouTube videos on your phone during the walk. Like just be bored. Let your mind wander because that's where the really valuable things happen.
[00:39:19] Michael Chan: So for those looking to supercharge their productivity, I know that you have 5 recommendations. What are those?
[00:39:26] Jason Lengstorf: Yeah. So I have- there are a few things. And like some of these might seem super obvious, but I find that a lot of times even the the obvious ones need to be reiterated. So uh the the first one is to track your time. So I install an app called RescueTime, and it just gives me a report at the end of every week on where my time went. So, for example, last week I got an email that told me that I spent 10 hours playing a game on my phone over the previous week, which is a disgusting amount of time to be looking at a screen. Um, so now I know, hey, I should maybe either like chill on that or maybe just delete that game altogether because I'm spending too much time on it. Um, the next thing is to timebox tasks. So, if uh if you're gonna do something, there's a a law, I think it's Parkinson's Law, is that work will expand to fill the time allotted to it. So, if you have something that you need to get done and you say, "Yeah, I'm gonna get that done today," and you don't timebox it, like, you'll finish it at 2:00 AM because you just- there was no urgency to get it done. However, if you say, like, go to a coffee shop without your charger and say, "I'm going to finish this thing before I leave." Like, I've never seen people be more productive than when they got 10% of their battery left, right?
[00:40:41] Michael Chan: So true. So true.
[00:40:44] Jason Lengstorf: Um, and so, yeah, so what I like to do is I use a timer and I say, "OK, I'm gonna give myself like 90 minutes to get this block of work done." And I've for me, I found that 90 minutes is the right uh the right rhythm. Other people use the Pomodoro technique, which uh I think is like 25-minute bursts. Um, my partner uses 60 minutes. Uh, a friend of mine uses 45 because he's got like ADHD, and so he can't sit still for that long. Um, but you know, he's very productive for 45 minutes, and then he needs to go do a lap, and then he can come back and do 45 more. So for me, I usually do 3 to 4 90-minute blocks a day. And after each 90-minute block, I'll stand up, make a cup of coffee, you know, maybe walk around the block. Do just do something to get my my mind off of the work. Then come down, start the timer again, and do it again. And whenever I stick to that schedule, I'm significantly more productive.
[00:41:36] Michael Chan: So the specific amount of time doesn't matter as much as just sticking to the schedule.
[00:41:40] Jason Lengstorf: Yeah, because like, so if you're gonna work on something and you say, "I need to work on this thing," and that's it, then you're working on the thing, but also Twitter's open and also Slack is open and also maybe you'll just look at your email real quick. And and so there's no urgency to get it done. But if you say, "I'm going to spend the next block of time," then you kind of have a a carrot and a stick thing. Like, I need to get this done, and my reward for getting it done is that I get to screw around on Twitter, or I get to like go have this snack that I wanted. You know, you're no longer like bringing your snacks to your desk and then pretending to work while you like eat, you know? Yeah. Um, so, and that's a that's a big problem for me specifically, is if I if I'm not blocking time, I tend to just say, like, "Well, I'll just kind of work on everything casually." But if I block time, Then I work sequentially, which is, you know, is gonna come into play here on the one of the later things. So then the the the third point is to front-load all of your important stuff. And what I mean by that is, like, willpower has been shown to be kind of a depleting resource. As you work throughout the day, your ability to say no to the easy way out gets significantly lower.
[00:42:50] Michael Chan: Mm.
[00:42:50] Jason Lengstorf: Um, you know, in the beginning, like in the morning when you first wake up, you have a lot of mental energy to dedicate to, like, a big, bad task, right? Yeah. So, a high school coach of mine used to say, "Eat the biggest frog first." Like, if you gotta eat a plate of frogs, eat the biggest frog first, right? Get it out of the way. Um, and and that's kind of the way that I've always looked at it. If you've got some, like, one major task for the day, do that first thing. Like, don't have meetings, don't check email, don't get on Twitter. Just sit down at your desk, do that task, or put at least like one solid block of work toward that task before you do all the things that distract you, before you have your meetings and your your email, these micro-decisions that just take a little bit of your willpower, a little bit of your mental energy. 'Cause at 4:00 PM, like the last thing you're gonna wanna do at 4:00 PM is sit down and do a high-effort task.
[00:43:38] Michael Chan: Right.
[00:43:39] Jason Lengstorf: And and I find that, like, you know how a lot of people end up being night owls in this job because they they spend their whole day bouncing between distractions? Mmhmm. And they wait for everybody to go home so that they get quiet time to focus. Also, have you ever noticed that like that's when you get your second wind? Yeah. Like, if you're out, you like go throughout your day and you're fine, and then around like 3:00 to maybe 7:00, you're kinda like sleepy, drowsy, you wanna lay around, and then you get your second wind and you're like ready to go party or whatever. I think that it's kinda the same thing. So like we get distracted, and then we hit the lull, and then like our second wind comes back and there's nobody to distract us, so that's when we focus. Yeah. If we can shut those distractions out earlier in the day, we can ride our first wind to getting things done instead of having to work in the middle of the night.
[00:44:24] Michael Chan: Interesting.
[00:44:24] Jason Lengstorf: Um, then I I also tell everybody to prioritize aggressively. That's the fourth point. Um, I a friend of mine and I have a joke. We call this the Highlander technique, because when you think about priorities, there can only be one. Uh, the word priority didn't even have a plural form until a management consultant in the '80s invented it. So, it, you know, when when you talk about having a priority, You can- there really is only one thing that can be a priority, because if you prioritize two things, you no longer have a priority.
[00:44:52] Michael Chan: Yeah.
[00:44:53] Jason Lengstorf: Right? You have distractions. So we uh we take our stuff- this is my friend Nate Green and I- we take everything and we put it into a tournament bracket. So your to-do list, take your to-do list and just write it out. And then draw a tournament bracket under each of those things. So take the first two things on the list and say, of these two things, Which of these is more important? And you can- whatever criteria you want. Which of these is is more likely to get me fired if I don't finish it? Or which of these is gonna bring me the biggest payoff when I complete it? And then choose one and move it to the next bracket. Move to the next pair, and the next pair, and the next pair, and then do it all again until you're left with just one thing that has the highest reward or the highest urgency or the the highest likelihood to get you in trouble if it's not done. And then just do that thing. And then once that thing is done, You can start again, or you can go to the thing that was like second in the bracket.
[00:45:41] Michael Chan: Second, yeah.
[00:45:42] Jason Lengstorf: Right? Um, but by doing that, you you get the you take the time to kind of meditate on what your work is and think through what is actually important and why is it important. And then you get clarity. Because of that, you do the Highlander technique and you end up with one thing that is clearly a priority because you thought through it. Um, and you know, there are other times when you just don't have anything that's that urgent, at which point you can prioritize by I would rather work on this. Sure. But you know, you have to prioritize. You should choose one thing that's the thing you're gonna do. Which then brings us to our last uh our last point, which is don't multitask. Um when you work on multiple things, there's a uh a context switching cost. And so this is a uh uh um Gerald Feinberg, I think his name was. I'm uh I'm getting that wrong. Gerald Weinberg? Uh it's a software- We'll look it up later. It's a software programming book. And I apologize for getting the name wrong. But um it's Basically, what he's saying is that whenever you're working on multiple things, there's a context switching cost. And the context switching is, as programmers, or as really as knowledge workers, in order to do work, we have to build up a mental context. We we're building up like all of the memories and background knowledge and the the organization of either files or or the history of the thing we're working on, whatever it is. All that has to get summoned up into memory. And then we have to kind of like build these things so that we can visualize Okay, here's where we are in the project, here's where we came from, and here's where we need to go.
[00:47:09] Michael Chan: Yeah.
[00:47:10] Jason Lengstorf: When you shift to another task, that mental context gets torn down and you have to move to the other one and then build that context again.
[00:47:17] Michael Chan: Yeah.
[00:47:18] Jason Lengstorf: When you look at at context switching like that, you've got a 20% loss of your time per task, which means that if you work on one task, 100% of your time goes to that task. If you work on two, 40% of your time goes to each task and 20% is lost to context switching. 3 tasks, 40% of your time is is lost to context switching. 4, 80% of your time is lost to context switching. Like there's just— it's it's if you get to the point where you're switching between like 5 things at once, you may as well just go home. You're not getting any work done. Yeah, yeah. Um and so it's— and and we've all seen this, right? Like we go to work and then we get shoulder tapped all day or we're like bouncing between emails, notifications are coming in. And we go home and we go, I did literally nothing today.
[00:48:00] Michael Chan: Yeah.
[00:48:01] Jason Lengstorf: Like I I don't know why I even went to work because I accomplished nothing. And it's because of that multitasking.
[00:48:05] Michael Chan: And you go in the next day and you're like, uh I'm like for standup, you're like, well, I'm doing the thing I said I was gonna do yesterday because I didn't do it.
[00:48:11] Jason Lengstorf: Yeah, exactly, right? And so, um so if we if we use the Highlander technique and we we agreed with ourselves to not multitask, then what we can do is instead of trying to multitask where you've got context switching costs, I work on one thing and then I take my break. That's my context switch, right?
[00:48:31] Michael Chan: Yeah.
[00:48:31] Jason Lengstorf: Then I can come back and I can work on a second task. Like it's not like it's not like you have to finish that project, you know, 'cause some projects are multi-week projects.
[00:48:39] Michael Chan: Sure.
[00:48:39] Jason Lengstorf: Um, but what you shouldn't do is work on that project for 5 minutes and then try to work on the other project for 5 minutes and then go back and work for 5 minutes. Like you'll never get anything done that way. So set aside serious blocks of time and try to break the task down into something that you can accomplish in like an hour. So if you're building a multi-week project, can you build this template or this component in the next 90 minutes? And then you then you're free to like switch to the next task and you can work on another project.
[00:49:06] Michael Chan: Or if you can't, break it down into smaller tasks that you can. Like, can I test this thing in like 90 minutes? Break it down into smaller things.
[00:49:14] Jason Lengstorf: Yeah, I have another like little framework that I use. I call it the atom technique, which is to break down tasks into really, really small pieces into their component atoms, right? Haha, very clever. Um, but it's a it's an acronym and it it stands for every single task needs to be actionable, timely, ownable, and measurable. Um, and so typically what that means is that when you break down any task, you end up with something that's like, I can do this in one block of time. It's an actual thing that needs to be done and there's a true/false criteria for whether or not it's complete. And it's got a single owner. Um, and when you've got tasks like that, it's really easy to slot those into first your prioritization. So you can you can very easily say this is the most important thing because it's blocking somebody else or whatever. And then you can also slot it into a a time slot and say, all right, I'm gonna do this in the next 90 minutes. And it's you know it's easy to multitask when you can see the end of what you're working on. Or it's easy to single task, I should say.
[00:50:10] Michael Chan: I just finished a book. I think it's called um The One Thing. I I feel like you would really enjoy it, but he he has a focusing uh question that he has. I can't remember exactly, but um it's something to the extent of What's the one task that by doing makes everything else easier or uh irrelevant?
[00:50:30] Jason Lengstorf: That's cool.
[00:50:32] Michael Chan: And yeah, and it just really blew my mind. But he he kind of goes into a lot of these things that you were talking about, too. Um, the idea that multitasking is an illusion that we invented for computers, right? Like it's a marketing term. And it was it wasn't until later that we tried to apply that to humans. Like, hey, you need to be able to multitask to do this job. But even in computers, the computer isn't multitasking. It's just switching really fast. Like it has the constructs necessary to switch really fast without you noticing.
[00:51:00] Jason Lengstorf: Well, and and even with computers, like there's a um there's a a concept called memory thrashing, where the computers are switching so quickly that they get nothing done. Uh and so when you're when you're— oh, God, I hope that I didn't just get that wrong. I'm gonna get like computer science nerd hate mail.
[00:51:17] Michael Chan: It's all right. This isn't a technical show.
[00:51:19] Jason Lengstorf: But yeah, I mean, it's like it's it's interesting because even with something like a computer chip, there is a context-switching cost. It's just very, very, very small comparatively for humans. Um, but you know, it's like I I love it as a concept, though, because you're absolutely right. And that sounds like a book that I definitely want to read.
[00:51:38] Michael Chan: Awesome. Hey, well, thank you so much for your time. I really appreciate um you telling us a little bit more about Gatsby. I really hope that this inspires people to get involved or uh even just be less afraid of the technology. Um and also just how to how to work better. Um I think that that's something that we all struggle with. And I hope that um kind of what you've said can help people before their their beard starts falling out.
[00:52:01] Jason Lengstorf: Yeah, I I really hope that your beard does not have to fall out for you to learn the lessons.
[00:52:06] Michael Chan: Awesome. Well, thank you, Jason. I uh I hope that we have you on again. This was a this was a lot of fun for me.
[00:52:13] Jason Lengstorf: Yeah, I I appreciate you having me on. This is a, this is a blast. We'll hopefully do it again soon.
[00:52:17] Michael Chan: This has been episode 28 of React Podcast. For links to the talks, books, and everything else mentioned in this episode, visit reactpodcast.com/28. If you enjoy the show and would like to offer your support for its weekly production, go to reactpodcast.com/partner and choose a Patreon plan. Check us out next week for a great episode with the inimitable Jared Palmer talking about suspense, hooks, and what they mean for libraries like Formik and React FNS. Thanks again for listening. We'll be in your ears again next week.
chantastic.fm