46: Progress with Houssein Djirdeh, on Progressive Web Apps and the Story of Building GitPoint with React Native
Houssein Djirdeh works with the Developer Relations team at Google, educating React developers on web application performance.
He created the world best iPhone and Android app for GitHub — GitPoint.
Chantastic asks about his experience creating GitPoint (a fully featured GitHub client, built in React Native), what performance vernacular like tti, fcp, and Web Workers mean, and common performance pitfalls and misunderstandings found in React apps.
They discuss the importance of limiting scope to ship a product, the performance value of Hooks, tools and automations you can use today, and which projects to follow for inspiration.
Featuring
Links
- Progressive React — How to build your React app so more people can use it
- Developer Relations — Evangelize Google technologies and passionately advocate for developers' needs.
- Houssein Djirdeh: Progressive React / React Boston 2018
- GitPoint — GitHub in your pocket 📱
- tti — Time to Interactive
- fmp — First Meaningful Paint
- fcp — First Contentful Paint
- fid — First Input Delay
- Web Worker
- Service Worker
- worker-dom — An in-progress (as in very-alpha) implementation of the DOM API intended to run within a Web Worker
- Lighthouse — An open-source, automated tool for improving the quality of web pages
- lighthousebot — Run Lighthouse in CI, as a web service, using Docker. Pass/Fail GH pull requests
- webpagetest.org — Run a free website speed test from multiple locations around the globe using real browsers (IE and Chrome) and at real consumer connection speeds
- bundlesize — Keep your bundle size in check
- web.dev — Get the web's modern capabilities on your own sites and apps with useful guidance and analysis from web.dev
- Prototyping Lighthouse Stack Packs
- developers.google.com — Build anything with Google
Sponsors
Infinite Red
In over your head with a React or React Native app? Infinite Red can help. They're React Native core contributors who've been designing, building and shipping apps for over 10 years. reactpodcast.infinite.red
Transcript
[00:00:00] Michael Chan: This is React Podcast. I'm Chantastic. What is a Progressive Web App? Why does it matter? And how does it impact you as a React developer? Today we sit down with Houssein Djirdeh to get answers to those questions. If you're like me and you're not totally up to speed on performance initialisms like TTI and FCP, or you're not super well-read on service workers, this is gonna be a great episode for For links and show notes, of which there are many, visit reactpodcast.com/46. This episode is made possible by Infinite Red. Create beautiful, functional web and mobile apps. Say you have an idea for a new product. You know it's gonna slay, but who builds it? Maybe you're a bright-eyed, single-person shop entrepreneur with an idea, or you have a big team, but they just don't have enough time. Partner with Infinite Red. They've been designing, shipping, and building web and mobile apps for over How do you know they're experts? They host North America's only React Native conference, Chain React, educating thousands of devs from all over the world. They have a really cool offer for React Podcast listeners. Start a new project with Infinite Red and get 2 tickets to their Chain React conference in July. Meet the team, learn what they're about. Now, if you're not sure how to utilize Infinite Red, check out our episode with CTO Jamin Holmgren. It's episode number 43 to hear all of the ways they partner with you regardless of your team size and help you build the best app possible. Visit infinite.red. Yes, infinite.red. Let them know we sent you and start building the app of your dreams today. Hey, Hussein, how you doing?
[00:01:51] Houssein Djirdeh: I'm doing good. How are you doing?
[00:01:52] Michael Chan: Oh, I'm doing- I'm doing great. Uh, I am super excited to have you on the show today.
[00:01:57] Houssein Djirdeh: Same. Likewise. Super excited to be on.
[00:01:59] Michael Chan: Cool. Well, today we're gonna be talking um a lot about things that you've been writing about and talking about this last year um with Progressive React. Some of the the terms, tools, and techniques that people can be using to make their apps more, you know, performant and fast for more users. Um but before we get into that, I just want to um learn a little bit more about who you are, what kind of things you like, and uh where you're working these days.
[00:02:25] Houssein Djirdeh: Yeah, no, absolutely. Um, so my name's Hussein. I I work in the Chrome Web Developer Relations team at Google. Um, I'm a developer advocate focused on primarily speed. Um, so one of the main things I I I I'm tasked on is to provide guidance to developers on how they need to how they should build their websites, make it performant, reliable, and as fast as possible. But one thing that I also try to focus on is doing that from a frameworks perspective. So many developers probably know exactly what they should be doing in terms of how to optimize their site, but many also aren't sure about how exactly they should do it with their current tooling, and I try to provide that guidance whenever I can.
[00:03:04] Michael Chan: Nice, how long have you been doing that?
[00:03:05] Houssein Djirdeh: So I've been Google for- I've been in Google for 7 months now. Time flies.
[00:03:10] Michael Chan: Wow!
[00:03:11] Houssein Djirdeh: Almost 7 months, yeah. Um, I've been working in just front-end development consultancies before that for a few years. Um. And prior to joining Google, I would I would do conference talks and blogs and and things about performance and progressive applications on my free time. Um so I've been into this space for quite a while, um but I've only been actually tasked full-time as developer advocate for about 7 months.
[00:03:35] Michael Chan: That's awesome. Was it a goal of yours to work for Google, or is it something that just came up?
[00:03:39] Houssein Djirdeh: I think it's something that's been in the back of my mind for years, um ever since I started just looking into web development. Um, and I was fortunate because the current manager that I work on, he- we've done open source work before, before I even joined Google. Um, and then sort of that was sort of the bridge that allowed me to get my, my foot in the door, um, which I'm grateful for. Um, but yeah, I think, I think joining Google is definitely one thing that I've been thinking for, for a while, but also doing a developer advocate role full-time, because as much as I enjoy doing advocacy work on my free time, it's completely sort of- it's a bit different when you- when you're not going into the office every day and working on a single app 8 hours a day. Sure. But sort of context switching here and there and just, you know, your entire job is essentially advocating, which I enjoy. And I- and I- and I think I'm kind of glad that I have the opportunity now.
[00:04:29] Michael Chan: That's awesome. That- now that is a word that I sometimes- I have like a hard time kind of like understanding the scope of it. I think that sometimes, uh, you know, it means completely different things at different companies. Um, as a developer advocate, what does that kind of mean for your, you know, your schedule? What does your day look like in that role?
[00:04:46] Houssein Djirdeh: Yeah, no, it's uh something that's definitely not clear-cut because every company that that have, you know, developer advocates or evangelists, they they might do things a bit differently. Um, so on my end, so the way Google works is we have developer relations teams for many different products. Um, so Android has a developer relations team, um, Firebase, Fiber, and so forth. I um I'm on the web team. So I think a lot of people get kind of confused because they they automatically assume that I'm advocating specifically for Chrome. Um and you know purely for, hey, Chrome has new features and new APIs. And that's part of my job. Um but I think that one of the main things we also try to focus on is that isn't the only thing we do, because the web as a whole needs to stay open. Um so it's not only just Chrome-specific APIs and tooling that we need to talk about, but also just progressive web applications, or in my context, how to- how people can build speedy and, and reliable sites. Um, and within web dev rel in Google, we have it split across different horizontals. In short, and I think in one sentence, my job is literally telling people how to build fast sites. And it sounds kind of vague, but there's pretty much a bunch of ways I can do that, which is interesting.
[00:06:03] Michael Chan: Yeah, that sounds like a, like a fun, a fun job. And I mean, the reason that we're talking today is that you've been kind of helping people in this space of, you know, developing the performance of their app. Like, hey, maybe you know how to make an app, but how do we make it performant for as many people as possible? I had a question for you with regard to your career. Um, kind of early, I think in one of your blog posts, I found something where you had said, um, let's see, that you were kind of- you'd kind of like wrongly assumed that coding or programming was not good, a good fit for you. I'm curious, what, what was your experience that led you to that conclusion?
[00:06:42] Houssein Djirdeh: Yeah, um, so I think a lot of people also get kind of mistaken because they- I think quite a few people assume that I've been developing for a lot, for a long time. Um, I actually haven't. I've only started web development in 2015, so that's a little over 3 and a half years ago. Yeah,
[00:06:58] Michael Chan: so yeah, wow.
[00:06:59] Houssein Djirdeh: I, uh, I, I studied mechanical engineering at school. And in my very first year at university, we had an introduction to programming course, and they were teaching C. And I think I think the thing about that is, for people, there's quite a few people in the class who've done some development in high school and earlier on, that sort of they sort of started off on a better foot. Yeah. But I I had never seen a line of code. And the way they taught in that course was they sort of firehose information to you, Every week we had to solve these these ridiculous tutorials and labs that just quite complex problems. Our midterms and our exams were all handwritten to the point where like if you miss a semicolon, they would dock you know however many points. So that was my first foray where like a few weeks into our course they were talking about, or maybe a few months or or whatever, they were talking about pointers and memory allocation, and for myself I was still trying to wrap my head around how does an if-then-else statement work? So after that course, I kind of told myself, and I remember telling a lot of my friends, that I don't think I'll ever want to do coding again. And I, and I, in my third and fourth year, I deliberately tried like shifting all my courses to just avoid anything that involved code. I did an internship after my third year that that had a little bit of Visual Basic and SQL programming, and then I noticed it's actually not that bad in a business context when you're trying to actually solve real-world problems. And then only after I graduated, actually, I was fortunate enough to join a startup incubator at my university, where the very first month I was like, how do I build a website? And I literally just googled it. And I was like, this is actually pretty fun. Um, so I feel like then I sort of like, something sort of clicked in me that said, okay, maybe this isn't as bad as it actually looks. And then once I started doing it in my first job, I was like, okay, this is actually really fun. I could see myself doing this for a long time.
[00:08:49] Michael Chan: That's awesome. That's awesome. I've heard a lot of stories actually through this podcast about people who are in different engineering fields, you know, like mechanical engineering or electrical engineering and, uh, just realized, you know, through kind of a similar situation as, as you, that there's so much fun stuff happening on the web in particular, like kind of beyond like just programming and algorithms and whatnot, but like what was happening on the web. And there's such a cool human element, I think, to the web, uh, that kind of draws a lot of us in.
[00:09:20] Houssein Djirdeh: I, I 100% agree. And I think a lot of people that I talk to in general who don't know anything about the web or programming, they, they automatically assume I'm just solving extremely complicated algorithms every DM my job and I tell them the same thing. I'm like, you know, there's a very nice UI element to a lot that we do, right? And I feel like that is kind of attractive, right? It makes it easier to sort of sort of see your work and see it in action and sort of get that connection, right? Yeah, I agree.
[00:09:44] Michael Chan: Yeah, that's awesome. Now, one of the first times that I had seen you on the scene was um this tweet, and I think it reads, um let's see, couldn't find a GitHub iOS app that had everything I needed. So I built one and you used React Native to do that. What like what inspired you to do that? I mean, this was I mean this was probably a year ago then, so if you've only been programming for 3.5 years, like this is pretty early on in your like in your career.
[00:10:13] Houssein Djirdeh: So, prior to that, prior when prior to when I started building that application, most of my work involved I think Angular 1 development. I sort of wanted to get my foot in the door, you know, trying out React, React Native. Um, and one thing that was always in the back of my mind was I couldn't find a proper GitHub iOS app that I just enjoyed using.
[00:10:36] Michael Chan: It's so true.
[00:10:38] Houssein Djirdeh: Right? And I was like, I've heard quite a few on Android that people use quite quite actively, but I just couldn't find one for my for my iPhone. And a part of me kept reading about React Native, and it started really getting popularity right then and there, and people were talking about how useful it is to get started. And I was like, maybe it's a nice thing to try out. Um, so I literally just decided to just mock up some simple, simple UIs, um, get a rough idea of how I wanted the app to look like, and then I just dived right in and started building. Um, definitely took a bit of time. Um, sure, I feel like that's one of the projects where you never know when to stop.
[00:11:12] Michael Chan: Yeah.
[00:11:12] Houssein Djirdeh: And part of me always felt like, you know, maybe we should have, you know, get out notifications in the app. Or maybe we should have, you know, the ability to add reactions to posts, right? So I feel like that kept happening until to a certain point where I was like, okay, now I actually need to release it. Um, there's still a lot that needs to be done, but if I get people to to hop on and help me, it can make a difference. Um, and I think that's the one thing that really got me was the number of people who were so interested in saying, wow, can we just hop on and help you build this thing? Because we like it too. And I was like, why not? Because that's that's an amazing feeling. Um, so yeah, no, I really enjoyed it. Um, I'm still maintaining it now when I get the chance.
[00:11:51] Michael Chan: Cool.
[00:11:51] Houssein Djirdeh: Um, again, I don't think I would have, you know, it would be anywhere near where it is today without my other maintainers helping me out. Sure, sure. Um, so a lot of them are now driving the efforts, which is absolutely amazing. Um, but no, it was 100% like an enjoyable experience. Plus it sort of really got me building something of a reasonable size using React Native. Which is super helpful.
[00:12:10] Michael Chan: That's awesome. What was your experience with React Native?
[00:12:13] Houssein Djirdeh: Yeah, I loved it.
[00:12:14] Michael Chan: Yeah?
[00:12:15] Houssein Djirdeh: Yeah, and I'm saying this again, I think everyone who uses React Native have slightly different opinions based on their own prior experience to building mobile apps. When I built Gitpoint, I only had very little experience building things with Android, um, and I had I have no experience building things with Swift and Objective-C. Um, so my first foray, even when I started building, I didn't know too much about React, I still had no problem getting started. So I enjoyed it, and I feel like the tooling and being able to debug for me was like, wow, in the browser it was like something just clicked in my mind. I was like, this is amazing. Um, so I really enjoyed it. With that being said, after I built the app, and and a lot of people get had the question saying, should I, you know, shift my current iOS app or Android app to React Native because you built this thing and it looks super cool? And I always, I always tell people there's, you know, slightly different different reasons and use cases to try something on React Native, depending on whether you don't have an app yet or if you already have an iOS or Android app.
[00:13:11] Michael Chan: That's actually something that interests me is as, you know, kind of your first big project, or it sounded like it was like one of your first kind of like big open source projects. Um, how was it using React Native to target two platforms? Cause that's like, that's a big take. I mean, if you have a team of people working on it, um, but definitely, you know, kind of doing this thing on your own, uh, how was, how was that? That experience?
[00:13:37] Houssein Djirdeh: Yeah, um, I think again that also falls into my mindset where I sort of felt like I needed to have everything out of the gate for both platforms. It was only right before release I told myself, okay, the iOS app actually performed quite, quite a lot better, um, and it worked fine without crashing nearly as much. And I feel like, okay, maybe I need to concentrate my efforts on just releasing the iOS app first, and then if people are actually interested enough, I will roll out the Android version.
[00:14:04] Michael Chan: Interesting.
[00:14:04] Houssein Djirdeh: So part of me was actually thinking maybe I don't really need to release an Android version, if people- that many people don't ask. But as soon as it actually launched, I think there were so many people actually commenting on the GitHub issue saying, can we please get an Android version? That drove me and other maintainers to be like, okay, I think we really need to actually spend some time and get this out the door. But I do agree, I feel like concentrating on both, even though something like React Native does give you the tools to make it a bit easy, it's still a lot of work. It's still a lot more work.
[00:14:30] Michael Chan: Yeah, that's a that's a great display of pragmatism to like kind of have a goal and like be working for it toward it and being like, you know what, like this thing's just not gonna work at all if I don't choose one of these things and then like backfill the other one.
[00:14:43] Houssein Djirdeh: Yeah, no, and as and as easy as it as it might sound, it definitely was like a hard decision for me to make at the time. It was like, should I be doing this? You know, should I just wait a little longer and get them both out at the same time, right? Um, but sometimes you're right, you just you just have to, I guess, cut corners when when needed, right? Yeah,
[00:14:58] Michael Chan: yeah, absolutely. Got it. Got to get it out and then kind of fix fix what you need after that. Um, did you develop with the REST API or were you using the GraphQL API?
[00:15:08] Houssein Djirdeh: Yeah, so I used the REST API. Uh, okay. And I think back then I was I was sort of under pressure, you know, let me just use REST API. I hadn't looked in too much into GraphQL at the time, so I was like, you know, let me just play it safe. Um, going back, if I could really If I had the choice again, I would definitely have used version 4, the GraphQL API, because there's a lot that's provided in that API that GitHub doesn't actually provide through the REST API. So now we have a bit of both in the app because there's so many features we want to show. I think reactions being one is only provided in the GraphQL API. So like we actually have to add a layer on top. Yeah. Yeah. Yeah.
[00:15:41] Michael Chan: That's really interesting. I've, I've been amazed at how, um, I guess progressive they've been in adopting the GraphQL API and saying like, hey, this is our future. Get on board with it.
[00:15:52] Houssein Djirdeh: Exactly. And in a way, it's it's a good thing because I feel like I only realized how nice and useful it was and how nice GraphQL makes the whole experience after giving it a shot. And I feel like if they were more so on the ball, if they were more so on the opinion of saying, hey, we have these two APIs, they both do the same thing, just use one or the other, I probably would have never looked at the other one, right? So in a way, I think it forces me and a lot of other developers to be like, okay, maybe let's see what this thing has to offer. And then you realize It's actually pretty good.
[00:16:18] Michael Chan: Yeah, yeah. It's the carrot, right? Like, oh, I really want that feature. I gotta use this thing that I'm not comfortable with.
[00:16:24] Houssein Djirdeh: Exactly, exactly.
[00:16:25] Michael Chan: Cool. Well, let's change gears here a little bit. I want to like dive into the meat of this show and talk with you about um progressive React. You've been writing a lot about this, talking a lot about this. Um, could you give us like just a high-level overview of what like kind of progressive React means to you.
[00:16:45] Houssein Djirdeh: Yeah, um, and maybe I'll just give a bit of a bit of history before the blog post too, just some context. Yeah, so I've given a few talks, I've written quite a few articles about just performance in general, and I'd always try to add, you know, framework-specific guidance whenever I can. Um, and then I gave a talk in React Boston in September of last year where my title was Progressive React. Um, and in that talk, I really wanted to just sort of talk about how to build performant React apps, and I think that's something a lot of people expect in a React conference. But I I want to do it with an angle of, one, talk about what React currently provides in terms of its own APIs and so forth, as well as third-party libraries that people build, but also talk about what's coming up in the near future and how that can make developers build applications that are progressive and performant without too much legwork. So when I think of the term Progressive React, I don't only think of things that make your application fast. I try to think of it in a way where people can build applications that other people can use and a lot more people can use, regardless of where they are or what the device connection is or how strong the CPU is. This is the idea of making sure all your all parts of your application are performant and accessible enough for your users.
[00:18:02] Michael Chan: That's awesome. Now, I know that for me, sometimes there are some acronyms that get thrown around in a lot of performance talk. And like I've had I've had trouble kind of finding them. I think I know a bunch of them now. But for for some of the listeners who are not familiar with some of these performance tools yet or performance terms yet, uh I'm and I'm sure that there's a bunch more and and and I'd love for you to add them. But like there's like TTI, TTL, service workers, and for a while there was like web workers. Um, could you like go through and kind of define real quick the terms that often get used for performance?
[00:18:37] Houssein Djirdeh: Yeah. Yeah. Um, so with one thing that we try to do in terms of actually gauging performance in the web, um, there are a number of performance metrics that we try to measure on a certain site and it allows us to sort of see how well a page is actually performing. Um, so TTI is one, and that's just the time to interactive. Or the time it takes for the JavaScript thread to settle and for the user to actually interact with your application. And there are others like FP, or First Paint, and it's essentially the time it takes for actual content to show to your users. And then there's First Contentful Paint, or FCP, and First Meaningful Paint, or FMP, where it's the time it takes for the user to see actual meaningful or contentful or actual contentful content. Okay. Um, there's now even more metrics that we're trying to provide to give us a little better idea of how well pages perform, um, such as First Input Delay, or FID. And that's essentially how fast users actually interact with the application in terms of how they- because Time to Interactive is more so a synthetic or lab metric, um, but First Input Delay is actually a real user metric of how fast users actually interact with the application, um, and how and how fast they actually tap the screen, yeah.
[00:19:48] Michael Chan: So this is measuring like when they when they were able to like perceive enough of the content to actually make a decision, like an actionable decision.
[00:19:56] Houssein Djirdeh: Exactly.
[00:19:56] Michael Chan: Interesting. Okay, okay.
[00:19:58] Houssein Djirdeh: And and and we're still, in the Chrome team, they're still doing a lot more exploratory work and and diving into trying to think of how we can sort of flush out these metrics and even create new ones to make things a lot easier um for people in general to gauge how well a site performs. Now, other terms like like service workers and web workers. So a web worker is essentially something that you can write that is not on the main thread and lives off a separate worker thread.
[00:20:25] Michael Chan: Okay.
[00:20:26] Houssein Djirdeh: Service workers are just one type of web worker. And and and they're a web worker that allows you to sort of do some additional work to improve the user experience that does not need to be on this main JavaScript thread. So one of them is caching actual important content. So for example, if you wanted to have a site and you know your users will most likely reload the page, what if you can cache certain you know images or JavaScript or HTML or CSS files? And so when the user actually reloads the page, they can get those assets from the service worker instead of the network. So by doing that, you immediately have a way for just users to get much faster repeat visits than getting that same experience they would get the very first time you load the application.
[00:21:09] Michael Chan: Interesting. What type- what types of work uh do you typically put in a service worker? Now, my understanding, and I have very limited understanding of all this, uh so it's an honest question, is um is that uh service workers don't have access to the DOM. Is that right?
[00:21:25] Houssein Djirdeh: They do not.
[00:21:26] Michael Chan: Okay.
[00:21:27] Houssein Djirdeh: There has been there has been now work that's being done by a lot of people in Google and Chrome team and so forth to see how much use how useful it would be for for workers to be able to access the DOM. So one library that Christopher Baxter in Google built is WorkerDOM, and he's trying to see how efficient, how useful that could actually be. But ideally- Interesting. Something like service worker is exactly like you said, something that doesn't need to access the DOM but can still still improve the user experience. So things like caching assets, providing background sync by sending push notifications to users, things that aren't core to the actual web page, but essentially improve the experience.
[00:22:07] Michael Chan: Very cool. Very cool. Now, in terms of like developing, or like in your development environment, what are some of the tools that are used or recommended to actually determine these metrics on our application? So like once we understand like what what the terms are, what the things we're measuring are, uh what are the tools that people have access to right now that would allow them to make more performant, more progressive apps?
[00:22:33] Houssein Djirdeh: Yeah, um so the very first tool that I I recommend to people just in general, because it's so easy to use, um is Lighthouse. So this is a tool built by the Google Chrome team that allows you to audit and measure your page against a number of things. So not only will it give you metric scores like TTI and F and FP and so forth, but it also actually measures your site along a lot of different audits and it tells you whether it's passing or not. For example, you are using a service worker, maybe you should use a service worker, or you're sending too much JavaScript down the wire, maybe you should consider code splitting. And the reason why this is the first tool that I would suggest is because you can easily access it just by opening the DevTools and then going to the Audit panel. Another thing I tell people that they can also use is something called WebPageTest. Okay. And this I think is sort of the next step because it allows you to run your web page on an actual real device that lives in a device.
[00:23:26] Michael Chan: Interesting.
[00:23:27] Houssein Djirdeh: And you can do this with a number of different devices and different connections. So you can say, I want to see how fast this website runs on a Moto G4 on a slow 3G connection. It can actually provide you with with with results of how well it's running, and it gives you sort of more of a real-world feel.
[00:23:42] Michael Chan: Is that an open service, or is that something that people pay for, subscribe to, and whatnot?
[00:23:47] Houssein Djirdeh: It's uh it's a completely open service. That's amazing. So it's webpagetest.org. Yeah, yeah, yeah. Um, and it's completely open, it's really easy to use. I think a lot of people sort of hesitate to start using it because it looks a little daunting, but then there's there's a simple testing— um, so there's an advanced testing panel and a simple testing tab that allows you to just enter a website URL, select a single test configuration, and start your test. So you don't have to actually worry about configuring a lot of things. Because you get something really simple right out of the box.
[00:24:15] Michael Chan: That's awesome. What is the difference between something like WebPageTest and subscribing to a service like Sauce Labs or-
[00:24:25] Houssein Djirdeh: Yeah, or SpeedCurve or so forth.
[00:24:26] Michael Chan: Yeah, yeah, one of those.
[00:24:28] Houssein Djirdeh: A lot of tools like Sauce Labs, SpeedCurve, Calibre are also extremely useful. And I think one reason why they're so useful is they can give you sort of reports and an analysis of how well your site is performing over a continuous basis. So you can get, you know, emails, you can get notifications on a regular basis on how well you're doing, as well as whether you're degrading or not.
[00:24:49] Michael Chan: Interesting.
[00:24:50] Houssein Djirdeh: Because one of the biggest problems we notice when we try to advocate performance to developers is it's very easy for developers to say, okay, something like service workers looks super cool, maybe I should code split, all these terms sound super nice, and sometimes they do it. But it's also very easy to not worry about that for a while and then have your site regress. And I think one thing we're really trying to do now is improve guardrails of all kinds, but those kind of tools are super nice because they can actually tell you how you're doing and give you more of a continuous monitoring effect.
[00:25:18] Michael Chan: Interesting. So so kind of in a practical sense, you could start your app and assume that you're not gonna be hitting some of these these major performance problems right off the bat while you're in those early phases where you're just trying to get features out as fast as possible. But you can set some, uh I guess, kind of like breakpoints, I guess, to say like, hey, if if we exceed this, we should probably re-review this part of it. Is that is that kind of the idea?
[00:25:42] Houssein Djirdeh: That's exactly it. So I think the one thing about tools like SpeedCurve and so forth is they can give you reports and analysis that whether you're not, you know, how well it's performing on a continuous basis. But I think you hit the nail on the head because there are a lot of third-party tools that can allow you to sort of add these checks either to your CI workflow or so forth. For example, Bundlephobia is a good example of a third-party library, um or sorry, Bundle Size is an example of a good third-party library that you can just hook up to your CI flow To the point where like you can get a message saying, okay, um, your site, your your entire bundle is greater than the max that you've set, we can't merge this PR. So like you already have those checks part of the development workflow, everyone on your team can be on board. Um, Lighthouse CI is another one that allows you to do the same thing but with Lighthouse scores. So you can actually say, okay, I only want PRs to get merged in if Lighthouse scores exceed 90 in performance or 85 in accessibility or whatever. So I think one thing we're really trying to have developers do in general is not to think of of improving performance as as something you need to just do as a one-off thing, um or something that you only need to do when your site actually degrades to a really noticeable effect, but it's something you can actually just do as part of your workflow. So just have it ingrained in everyone's mind from the very beginning, and it's something you would never really have to worry about down the line.
[00:26:57] Michael Chan: Yeah, that's something that I see a lot is this idea of like someone gets, you know, maybe one specific performance tool in their head, like in in the React community. And it just, that's their hammer. And like everything is like, we got to do this every single time. You know, you see this with kind of binding uh uh functions and in React components and pure components and all that kind of stuff. And there isn't that sense of pragmatism around, you know what, this is probably under our uh our performance, you know, threshold. And, you know, once it becomes a problem, then we can start to add those like additional features to, to, to make it faster. What are some things specific to React that you see as a common uh performance issues, or what are some of those areas where an app can kind of grow uh in a way that makes it a- or introduces a performance problem?
[00:27:49] Houssein Djirdeh: Yeah. Um, the very first thing that I think of when building apps in general, React or not React, is I think a lot of people don't think about code splitting right out of the gate. So they're building this app where very, you know, initially things are okay, the bundle size isn't that large, and it feels like your app is kind of fast. But as soon as you keep adding more features and more components and more utilities and so forth, the bundle size just grows up, right?
[00:28:16] Michael Chan: Yeah.
[00:28:16] Houssein Djirdeh: And I think the the reason why code splitting is so useful, because for one, I think it's probably the easiest thing to get started in terms of just cutting down how much JavaScript you're shipping to your users. And two, it's it's something that if you begin doing at the route level, you don't really have to worry about it uh more than that unless it actually becomes even more of a problem. So I think it's something that's really like something people should think of immediately when they're thinking of building a large site.
[00:28:41] Michael Chan: Interesting. Is there a good example of you know maybe like a codebase or a project that's doing that kind of like out of the box, like splitting things at the route level by default?
[00:28:52] Houssein Djirdeh: Yeah, so Next.js is a great example of a framework that ingrains this automatically to the point where anything you import gets code split, right? And it's like you never have to worry about that as a developer. Um, but even if you're not using Next.js, I feel like something like the React docs shows really simple ways of just doing that with Suspense today and using something like React Router. Um, so yes, it is possible to code split even more than the route level and actually do it on a component level whenever you want to. And I think that's great if developers are already taking that step. But I think just by setting up your routing configurations that way, you can get so many wins without even doing that much more work.
[00:29:29] Michael Chan: That's awesome. Uh, what do you think uh the role of Suspense, kind of as that gets fleshed out, is going to play in uh you know performance or some of these maybe more human metrics that we've um that you mentioned earlier?
[00:29:43] Houssein Djirdeh: Yeah, um, so Suspense, it's amazing because One, it gives you it gives developers control on where they would like loading state to show. Um, it allows developers to suspend multiple components from loading even if they're being lazy loaded. And all that can be done today. Um, but then we have this this shift towards concurrent mode where we can have parts of our UI that doesn't block rendering and have some parts of a site be responsive while others are still being rendered. And from a user experience of not showing a flickery loading state when you don't need to, this is super useful. Right? Like we can build UIs that don't feel slow without that much work. And it's amazing. Like it's an amazing UI.
[00:30:21] Michael Chan: Yeah.
[00:30:22] Houssein Djirdeh: So from a developer experience, it's so nice. But I think by ingraining Suspense, the mindset of Suspense and and and code splitting, which is available today, developers can already just now get used to the idea of just adding this pattern whenever they can. So now you're getting code split components, code split routes, and it's part of React API, you're not doing anything that really seems out of the ordinary. Um, and then later this year when they start introducing it with data fetching, we can get away with more than just actually code splitting, which is which is super useful.
[00:30:52] Michael Chan: Yeah, it's super super exciting. Um, what are some things in React, uh I mean maybe we've talked about them all, but some things that you're excited about uh kind of coming down the pipe that um that we should be excited about in terms of performance, or maybe even Create React App et cetera, anything in the React community?
[00:31:08] Houssein Djirdeh: Yeah, um, I think one thing that that I'd like to mention is we're sort of thinking of ways to build tooling or or or figure out ways that people can have things that just provide better guardrails. Like I mentioned, I think one thing that developers have is they don't have is just things that can constrain them in a good way so that they don't really get too far out of the box. Sure. So that's one thing that I'm I'm super excited about. Um hooks is just generally super exciting. I think everyone at this current point is just really looking forward to um the whole concept and just trying it out because it feels amazing. Um but in terms of even performance, using hooks could essentially cut down bundle sizes because code that use hooks can minify better than the same components that use classes. And I think the amazing thing about this is For one, people that dive into hooks, they're not thinking of that. Most people just want to actually use it because it allows you to do a bunch of things with functional components that you could only have done before with class components. It allows you to incorporate logic into your components so that it can be reused in other places without using a library like Recompose. I think a lot of developers jump into it because they see the benefit of that. But I love the idea of, wow, while they're doing this, they can just notice wins in their bundle size. And I think I saw a mention of how if it ends up being super successful, the possibility of moving class support into its own package is actually being considered. And this is pretty huge.
[00:32:33] Michael Chan: Oh, wow.
[00:32:34] Houssein Djirdeh: Because we can get the wins of of having a reduced bundle size for everyone right out of the gate.
[00:32:38] Michael Chan: That's crazy. I hadn't really considered the implications of having those, but yeah, they're just I mean they're just functions and I mean all of our bundlers are like really good at minimizing functions.
[00:32:49] Houssein Djirdeh: Exactly, right, exactly. And even if it's something that doesn't you know, get extremely positive wins in terms of cutting down bundle sizes, even if it's tiny, it's a huge deal if everybody on the React community or a large part of the React community ends up using it, right? Um, I feel like the efforts with React Fire, I love that name. Yeah. But um, the efforts there, they're trying to do to trim their bundle sizes down by by cleaning up a lot of the event handlers they're using, then anything, a lot of the polyfills they think they don't need. That's a plus because again, this is something that's just core. that will be improved.
[00:33:19] Michael Chan: Yeah.
[00:33:20] Houssein Djirdeh: In terms of just guidance in general, I think one thing that I'm trying to do actually is- is so for people who don't know, who are listening, web.dev is something that we released that provides pretty interactive guides to users in terms of in terms of code labs and interactive articles. And right now there's a lot of guides that provide you know information on how to optimize the JavaScript and the images and so forth on your site. But one thing I'm trying to focus on in the next few months is provide that type of guidance using React as as as the foothold. Like, how can you do all those things while using something like React in your site? I think that will be super useful to people who don't really know about how it would work otherwise and just want to have something that makes sense to them with their current applications.
[00:34:03] Michael Chan: Interesting. So taking the knowledge that's in web.dev right now and applying that specifically to a certain framework, a certain toolchain, and saying, hey, for you, this subclass of people who need performance help, like these things are totally targeted to you.
[00:34:19] Houssein Djirdeh: Exactly, exactly. Cool. And I think this is something that's really down, like not even anytime soon. But one thing that I've also been helping out with is something called Lighthouse Stack Packs. So for people who use Lighthouse, it also provides very generalized advice, right? Um, to the point of like, it'll tell you, hey, you're not code splitting, for example, maybe you should consider it. But a lot of people, again, that let's say run Lighthouse on their site, who are using a specific tool, not just React, it could be anything, it could be WordPress and so forth. They might be, their first instinct might be, how on earth do I do this, right, with my current framework, right? So one thing we're trying to explore is what if we can do that, you know, with Lighthouse and sort of be able to detect what's on your site but give you more specific advice. And then what I'm super looking forward to is not only gonna have those, that sort of mindset with tools like Lighthouse, but we'll also have those sort of mind- that sort of mindset with tools like web.dev. And if we can get that sort of connection to all the guidance we provide, we can actually sort of target developers a lot closer to their home, right?
[00:35:15] Michael Chan: That's awesome. I I I love that idea of targeting people a little bit closer to the home. That's that's awesome. Uh so this has been incredibly informative. Thank you so much for taking the time to explain all of those things and talk about what's kind of coming up in the future for web.dev and where your focus is. Uh where can people find more out about you, the things you're working on, and the things you got coming up?
[00:35:38] Houssein Djirdeh: Yeah, um, I think that one thing I would say is just follow me on Twitter. Um, yeah, um, yeah, 100%. I feel like I try to just talk about all these efforts as much as I can. Um, my Twitter handle is @HDjrdh, my last name, so H-D-J-R-D-H. Um, that's one place to keep to keep an eye out. Um, keep an eye out in the Chrome Developer channel on Twitter. Keep an eye out on the developers.google.com google.com website as well. So we sort of put those announcements and these sort of things there whenever we can. Um, but yeah, I feel like just just doing those things, you'll definitely hear about it, um, which is super cool. And I'm hoping again, you know, the next few quarters there'll be a lot more of these sort of tools and and guidance that we provide that people will actually like.
[00:36:18] Michael Chan: Very cool. Well, thank you so much for this chat. Thank you for kind of all the work that you've been doing to help us React developers uh make more performant sites and uh hit a wider audience. Uh, yeah, thank you so much, Hussein. I I appreciate it.
[00:36:34] Houssein Djirdeh: Thank you, Michael. No, I appreciate it. Thank you so much.
[00:36:37] Michael Chan: A big thanks this week to Houssein Djirdeh. If you don't already follow him on Twitter, I really recommend it. Sometimes developer advocates can get a bad rap and he is so kind, so helpful. If you want to know how to make your app faster but aren't prepared to deal with the guilt, uh, follow Hussein. He is a great advocate. A big thanks also to Infinite Red. If you want an expert team to help you build your web and mobile apps, please hit them up at infinite.red. Let them know that we sent you and you will get 2 tickets to the upcoming Chain React Conf where you can meet the team and learn what they're about. And lastly, thanks to you. You make this show possible and I'm so grateful. This episode of React Podcast was edited by Mikael Delport. It was produced by Mikael Delport and Sarah Jackson. You can find React Podcast on Speck, a network to help designers and developers level up. Visit spec.fm to find other shows that will take you further in your career. Help us out by reviewing this show on iTunes. Your reviews help the show grow and help us ensure great guests and awesome content week to week. To join the discussion. visit reactpodcast.com/chat or follow us on Twitter @reactpodcast. I'm @chantastic. To stay out of the discussion but get updates, visit reactpodcast.com/news and sign up for emails. Thanks so much for giving us your attention. We'll be in your ears again next week.
chantastic.fm