19: Supporting Open Source with Michael Jackson
Chantastic talks with Michael about his journey into open source and how he's building a business to sustain open source development. They discuss frontend libraries (then and now), the link between business and open source, the genesis of unpkg.com (a CDN for NPM), and the future of modules in the browser.
Featuring
Links
- Shadowbox.js — Michael's first open source project
- React Router
- UNPKG — A CDN for NPM
- UNPKG: The CDN for everything on npm — Michael's 2017 React Rally talk on web modules
- Can I use
modules— Browser support forscript type="module" - Babel on Open Collective — Support JavaScript innovation by donating
Transcript
[00:00:06] Sponsor: This episode of React Podcast is brought to you by ReactTraining.com. In-person, hands-on training for development teams from React community leaders and experts. Visit ReactTraining.com to learn more.
[00:00:20] Michael Chan: This is React Podcast. I'm Chantastic, and today I have the privilege of talking with Michael Jackson. Uh, you know him as the host of React Podcast, but this is gonna be his first time as a guest. Uh, he's the owner of React Training, uh, maintainer of React Router, and creator of Unpackage. How are you doing today, Michael?
[00:00:49] Michael Jackson: Dude, I'm doing awesome. Thank you for uh having me on the show. It's funny to be uh normally be the host and now be in the guest seat.
[00:00:57] Michael Chan: How's it feel to be a guest? Do you feel uh like the lights are lights are on you? No, it feels good.
[00:01:02] Michael Jackson: It feels good. Yeah, no, I I I do actually. I um it's kind of funny. Uh I feel like sometimes as the host of the podcast, like I have these thoughts about like, and I've mentioned it several times on episodes with other people. I'm like, oh yeah, that's how, that's we did that in React Router. And then I was like, oh wait, I'm talking about myself again. I should probably talk about talk about this person who's on the podcast. And um
[00:01:26] Michael Chan: I imagine it's hard to It's hard to turn off when you're like thinking about that all the time.
[00:01:31] Michael Jackson: Yeah, well, yeah, exactly.
[00:01:32] Michael Chan: Like, 'cause you probably just closed an issue on something or like having a conversation, then you turn the podcast on and you can't get it outta your head.
[00:01:38] Michael Jackson: Well, and and we always interpret things that other people say in the light of our own experience, right? So like as somebody else is talking to me, it's like, how am I interpreting this thing? Oh, based on stuff that I already know and understand. So anyway, yeah, it is, it's hard to turn it off. It's just part of who I am, I guess.
[00:01:56] Michael Chan: So, um, I wanted to know, how did you get into uh programming? How did how did you start? Did you always know you were gonna program, or was there a moment where you're like, I'm switching to this thing, it sounds awesome?
[00:02:07] Michael Jackson: I remember very, very clearly, actually. I was in college. Um, so I had done a little bit of code before that point. Um, in high school, I had like a GeoCities page. I remember being very very proud of that. It was actually a uh um it was a guitar website. And I basically just had a bunch of links to all of the different uh you know guitar manufacturers and people who were making strings and people making pedals and like all sorts of um you know accessories and stuff, 'cause I'm really into music. And um and and it was it was just basically a collection of links. Like there wasn't really anything else to the site.
[00:02:48] Michael Chan: Kind of like the internet at that time, really.
[00:02:50] Michael Jackson: Yeah, exactly. That was what the internet was. And so it was like a it was like Hey, I like to play guitars. If you like to play guitars, here's links to all this cool stuff. Um, and that was, you know, a page on GeoCities, but I I didn't, you know, it was just HTML, a little bit of CSS. I remember I got like, I got a little bit into the graphics and stuff and made like a cool banner for myself. Um, but-
[00:03:09] Michael Chan: Did you have like some rounded corner, uh, like uh Photoshop cutups? So you get those nice rounded corners?
[00:03:16] Michael Jackson: Yeah. Yeah. Well, no, it, you know, what was interesting actually is, um, GeoCities actually had a like a forum where you could go and get help with your website.
[00:03:26] Michael Chan: Really?
[00:03:27] Michael Jackson: Yeah, it it it was amazing, actually. I I don't- I mean, I guess maybe the modern equivalent would be like Stack Exchange, maybe. But okay, but this guy- well, I there were a couple of people there. There was one guy who like actually made- he was just making banners for free for people. Wow. Just just to practice. And so he was just like- I was just like, hey man, I need a banner. And he was like, I mean, he got me this great-looking banner within like a week. There was another guy there who who knew a lot about um Perl. And one of the cool things with uh GeoCities was you could drop in your own like Perl scripts.
[00:04:02] Michael Chan: Nice.
[00:04:03] Michael Jackson: And so I had like a little guest book. And and and the the guest book was literally just a Perl script that you dropped into the CGI bin. And then you put a form on your page and said, you know, the action of the form was that Perl script. And then, and then, uh, and then somehow the comments, I don't remember exactly how they showed up on the page, but it was cool, like getting into programming like that because I I didn't, I wasn't actually writing code at that point, but I was kind of piecing things together from other people who were more experienced, who were kind of helping me out with it. I I really have fond, fond memories of of GeoCities. It's a shame that like nothing quite like that exists today, I feel like.
[00:04:41] Michael Chan: There isn't. So, I I did a little bit of uh PHP in the early days. And that experience was so fun. And yeah. And I had wanted to do Ruby because it seemed like that was the hot thing that was taking off. Yeah. Um at the time. But there's something fun about saying, I want to do this thing. And you can do it all in one file that you just upload to your server. Um as opposed to like having a framework. And I mean, now it seems like everything has a build step.
[00:05:08] Michael Jackson: Yeah. You said you did PHP. Um, did you did you ever do CodeIgniter?
[00:05:13] Michael Chan: I did, yeah. Dude. I built uh one site. It was like a uh company that did classic car restoration, I think. And I built a little, uh I don't know, CMS type thing for them to be able to post their their cars or whatever.
[00:05:28] Michael Jackson: CodeIgniter was awesome. It was awesome. It did everything.
[00:05:32] Michael Chan: Yeah.
[00:05:32] Michael Jackson: Like if you needed to resize image thumbnails or you needed to send an email or you needed to like communicate with your MySQL database, database, whatever you needed to do, you just had like this one global sort of thing.
[00:05:45] Michael Chan: Yeah.
[00:05:45] Michael Jackson: And and you were just like, CodeIgniter, do this. CodeIgniter, do that. It was awesome.
[00:05:49] Michael Chan: It was.
[00:05:50] Michael Jackson: And now I look at building websites and I'm like, oh man, it's a lot more complicated than that.
[00:05:55] Michael Chan: It is. It is. I mean, the stuff we're doing is a lot more complicated too.
[00:05:58] Michael Jackson: Yeah. So uh so anyway, so that that was kind of how I got I got started back in the day was I did a lot of, uh you know, started out with just HTML and CSS. Then um then I I actually got into a lot of PHP when I was in college. That was my Uh, that was kind of how I, um-
[00:06:13] Michael Chan: What were you studying?
[00:06:15] Michael Jackson: Started like writing real code. So I was studying uh information technology at uh BYU. It was a brand new program at that time. Um, and uh, and then I I actually switched over to information systems, which is a little more of a business focus, but I I somehow got a job uh just writing PHP coding for the visual arts department on the BYU um on the BYU campus. So it was an on-campus job. Um, and you know, it was funny, it's because the only the only reason I applied for the job is 'cause it was the highest paying job on campus. So it was $12 an hour.
[00:06:53] Michael Chan: Nice.
[00:06:53] Michael Jackson: Which, um, you know-
[00:06:55] Michael Chan: As a college student.
[00:06:56] Michael Jackson: Yeah, exactly. And compared to-
[00:06:57] Michael Chan: A rough net.
[00:06:57] Michael Jackson: Compared to, exactly. Compared to most of the, uh, most of the other jobs on campus were like 10 or less. And so I didn't really know how to code, but I applied for it and they're like, yeah, sure, you seem sharp. Like you can do this. So I kind of taught myself PHP and JavaScript, um, kind of on the job there. Um, yeah. And I really got into, uh, some of the first things I did was I I really got into this thing called uh MooTools, which a lot of people, a lot of people know. I I actually had, it's a funny story, I actually had um commit rights at one time to the MooTools repo.
[00:07:31] Michael Chan: Nice.
[00:07:31] Michael Jackson: Um, and this was like just when it was brand new, like they had just moved off of MooFX. And uh and I was I was I was writing some code in MooTools, and we were we were uh managing everything in Subversion actually at that time. And uh I I was I was kind of uh I was young. It was the very first project that I had ever been involved in, very first thing I had ever done, uh open source project. And I I think I I pushed it a little too far because one day I one day I was like, you know, I've written so much code for this that like I'm basically one of the authors too, right? So like like there was this other guy who who had written a lot of the code. He's an Italian named uh Valerio Proietti, and he had done a lot of uh code on it. And and I had one commit where I was like, I added my name to the copyright line.
[00:08:23] Michael Chan: Ooh.
[00:08:24] Michael Jackson: So it was like-
[00:08:25] Michael Chan: That's bold. That's bold.
[00:08:27] Michael Jackson: It was so it was so stupid of me, but but but I was like- And you got a notification like 5 minutes later that you were off the- Yeah, I was off the project. I felt some ownership of it though. I was like, you know, I've been writing a ton of code for this thing. Like, I'm one of the authors now too, you know? And um, I just, I didn't realize that that's not, that's not how it works. Um, and so next morning I woke up and Valerio was like, no, no, you're not committing any more code to this repo.
[00:08:52] Michael Chan: Wow. Um,
[00:08:53] Michael Jackson: and so that was, yeah, that was the point where I was like, oh man, I screwed it up. Um, but you know what was funny is, um, the jQuery the jQuery guys were always like showing up in the MooTools forums. And it was hilarious because the MooTools, we had a kind of a verbose syntax. Like, you know, we were extending the element prototypes and stuff like that. And so it was like, you know, element dot, you know, do something dot something else, right? Oh
[00:09:21] Michael Chan: yeah, I mean, that's where the smoosh problem comes from, right?
[00:09:24] Michael Jackson: Yeah, yeah, exactly. Because they were extending the array prototype and all the all the built-in prototypes. And um um and so it was like very verbose. And then the jQuery guys would come along and they would be like, check it out, $animate. And we were like, oh, those guys, they have such a slick API. But it's not like, oh, those guys. And it was so it was so funny because um like deep down I was like, yeah, jQuery is probably the thing. Like he he nailed the API with jQuery and and the story around extensibility and stuff like that. Yeah. And so then I just started using jQuery when I got kicked off of MooTools. But uh but yeah.
[00:10:03] Michael Chan: I know where to go after that.
[00:10:04] Michael Jackson: Yeah, I was just like, these guys, you know, I kind of had a hunch that these guys were onto something all along. I'm just gonna go over here and use this.
[00:10:09] Michael Chan: So was that your first experience with open source?
[00:10:12] Michael Jackson: That was actually my first experience with open source. Cool.
[00:10:16] Michael Chan: How did how did you dive in? Like, did you know somebody on the team or you just uh created an issue and they were like, here's how you could fix it?
[00:10:23] Michael Jackson: You know, I just showed up in the forums and just started talking to people and like helping them through their issues with their code. There was one, uh, there was one, you know, and and and I had ideas for things that I wanted to do. Like, for example, um, MooTools, we had this, um, you know, we had the dollar sign function, but it was only for selecting an element by uh ID. And then jQuery came along and they were like, you can put a CSS selector in there. And so you can, you know, select elements a lot more easily. And I was like, oh, you know, we should probably have something like that because that's a really nice API. That's just probably a way better API than selecting stuff by IDs. And so, um, you know, so I built like this big regular expression. I honestly probably just like copied a lot of what they were doing in in jQuery, but I built this big regular expression for like chunking through a CSS selector. Um, and uh, and then so we could do, so we could do that kind of thing. I remember another one that was really big back then was um, uh, Ext
[00:11:27] Michael Chan: Yeah, yeah.
[00:11:28] Michael Jackson: And and he had- what was that guy's name? Ah, anyway, he he had like- he came out with a benchmark one day and just blew everybody away because he was- he what he was doing was the rest of us were, um, we were building engines that would like parse the selector and then, you know, essentially compile the selector at runtime and then go and select all the elements that you needed. Uh, but what he was doing was he he had compiled the selector down to a function using like eval essentially. Yeah, yeah. Like he was building JavaScript uh strings and then evaling that. And so he had like this this function that was fine-tuned that would only do the minimal amount of work necessary to select all of those elements, you know? And and I remember him coming out with that benchmark and just being like, wow, this this guy is really fast. And that that was ExtJS. And and I I don't know, it was it was just a fun time. It was a fun time. Dean Edwards was doing a lot of cool stuff. Of course, John Resig. And and there were a lot of people who were just, you know, just experimenting. Sam Stephenson, obviously, with Prototype. A lot of people just sort of experimenting with JavaScript. So yeah, that was that was kind of the time when I started to really get into coding. And it was just, again, 'cause I had that uh I had that job coding on campus.
[00:12:42] Michael Chan: It's really interesting as you talk about those um kind of three factions or like those or four kind of competing libraries.
[00:12:50] Michael Jackson: Yeah.
[00:12:51] Michael Chan: Um, it seems like you have one that's kind of like trying to just extend what the browser's already doing. Prototype. jQuery that is uh.
[00:12:59] Michael Jackson: Completely replacing the browser API.
[00:13:00] Michael Chan: Replacing the browser, giving you a more uh kind of consistent API, um something that that feels right all the time. And then uh Ext JS, which is just mega fast. Like that's the feature. And it seems like those are those are the things that we still kind of compete on today.
[00:13:14] Michael Jackson: Yeah. Almost.
[00:13:15] Michael Chan: Like if you look at the the landscape, even in React, there's like uh what Preact, which is you know very like small and kind of you know performancy.
[00:13:24] Michael Jackson: Yeah.
[00:13:24] Michael Chan: React, which kind of like defines that like API. And then I don't know.
[00:13:28] Michael Jackson: Like the web components, Polymer camp. Just like use the platform.
[00:13:31] Michael Chan: Use the platform.
[00:13:32] Michael Jackson: And then you've got like the, uh, um, I guess, uh, you know, I guess I I I tend to kind of lump Angular and Vue together because they both use templates and things like that. So they're they're kind of like, uh, yeah, they're kind of like the the template camp, I guess. And Ember is is in there with them too, like the Handlebars Angular.
[00:13:52] Michael Chan: Yeah.
[00:13:52] Michael Jackson: Anyway.
[00:13:53] Michael Chan: So what was the first thing that you open-sourced on your own?
[00:13:57] Michael Jackson: So my first open source project was something called Shadowbox.
[00:14:00] Michael Chan: Used it.
[00:14:01] Michael Jackson: Which has fallen into- you used it?
[00:14:03] Michael Chan: I did.
[00:14:04] Michael Jackson: Yeah, right on.
[00:14:04] Michael Chan: I did.
[00:14:04] Michael Jackson: We were talking to Ken. He used it the other day too. That was pretty cool. That was 2008. So that was 10 years ago.
[00:14:10] Michael Chan: Wow. It's crazy.
[00:14:11] Michael Jackson: Yeah, it was nuts. Um, I I had seen the very first Lightbox by a guy named Lokesh Dakar, I think was his name. Um. And uh he built this thing called Lightbox. And and you know, it was just, you'd click on an image and then it would pop up and it would animate and show this image on the page. And I was like, wow, that was amazing. Um and I was working, like I said, I was working for the visual arts department at BYU, and we had a lot of you know pictures and things that we wanted to show. So I wanted to show them in a nice kind of lightbox. Um except we also had students who were applying to like the animation program.
[00:14:47] Michael Chan: Yeah.
[00:14:48] Michael Jackson: Um, you know, and they had they had like movies and stuff that they needed to show. Um, and so I needed to put a movie in there, and I couldn't figure out how to put like a QuickTime movie into the lightbox. Um, and and so, you know, so that was kind of- so then I wrote my own little script basically that would make a little lightbox, and you could put a movie in it. And then I was like, what the heck, like you should be able to put anything in here, because then students would show up with like Swift files, so they wanted to put Flash stuff in there. So I was like, okay, fine, put a Flash file in your in your lightbox. Um, you know, put a put an iframe in there and show us your website, you know, like show us like whatever you want basically. And uh, so so I built this thing called Shadowbox and I put it up online and uh I I don't still maintain the website today. Somebody else bought the domain and like there's this weird variation, like this weird twisted variation of what I had.
[00:15:36] Michael Chan: Yeah, it does seem super weird. So my question from that is, are your initials, your middle initials J and I?
[00:15:42] Michael Jackson: Yeah.
[00:15:42] Michael Chan: Okay.
[00:15:43] Michael Jackson: Yeah.
[00:15:43] Michael Chan: So they at least kept all of the-
[00:15:45] Michael Jackson: Yeah, like they kept my name on there, but then there's like some weird- there's some other weird stuff on there. I need to- I need to contact them and be like, dude, this is part of my legacy. What the heck are you doing? This is weird. But yeah.
[00:15:54] Michael Chan: It's the first thing I ever made. Come on, show some respect.
[00:15:57] Michael Jackson: Yeah. So that was the first thing that I ever open-sourced. And um, it got huge because um, Ray Bango, now at Microsoft, he uh, he was running a blog back then called Ajaxian.
[00:16:11] Michael Chan: Yeah.
[00:16:12] Michael Jackson: With uh Ben Galbraith and Dianne Elmer. Mm-hmm. And they were, uh it got posted to Ajaxian one day and it was like the rest was history. Just blew up. Yeah, Ajaxian was the thing, man. That was that was where you would go to.
[00:16:25] Michael Chan: That's probably where I saw it.
[00:16:26] Michael Jackson: Yeah, that was where you would go to find out all the news about everything that was going on. It was such a good blog, such a good resource.
[00:16:32] Michael Chan: Yeah, yeah. That's awesome. So how does, uh as an entrepreneur, you're running React Training. Uh, owner of React Training, uh, teaching, uh, gracious supporter of the show. Um, how does the uh relationship of open source and your business work? Because you're doing uh History, React Router, a couple smaller projects, but those are probably the two two big ones.
[00:16:58] Michael Jackson: Yeah, yeah, right now. So, uh, so yeah, I I work on uh the History library and React Router, kind of those two uh kind of paired together like the big ones. And then Unpackage, which is kind of its own own thing right now, but um but that's open source as well. And so what I do right now is um you know I do I do training full-time, which means I'm traveling a lot. So I go and I'll train uh different companies on um on React. I offer 2 courses on React right now. So there's like a fundamentals React fundamentals course and then an advanced course. Uh the fundamentals course is just like an intro to React, and then the advanced course is like patterns for code reuse and stuff. Um and I I I spend kind of probably about half my time doing that, and then the other half of my time I spend uh writing code and and pushing to GitHub. So, um so yeah, that that's kind of how I split half my time. And and the reason for the company, honestly, is, um you know, I started the company originally with with Ryan Florence. And uh we started the company because because of React Router, because it was so big. Yeah. And a lot of companies were using it. And, uh, you know, if if if you don't have financial backing in some form for an open source project that gets huge, uh, it it it either takes over your life and completely ruins your life. Um, and I've and I've seen that happen to quite a few people. Um, or uh or or the project just gets abandoned. Yeah. And you leave everybody hanging. So so we had to secure some sort of financial backing for it. And I was like, either we can go out and ask people for donations, which is a totally acceptable approach. You know, that's what Webpack and Babel have done. Like other, you know, similarly sized projects have gone out and asked for backing and they've gotten it and it's great. Or I thought, you know, we could spin up a business around it and and try and, by, you know, through our own work, uh, you know, support our families and and then have time to work on it. So that's that's the model that we're pursuing is uh by offering training around React, uh, we can, you know, keep working on open source and keep keep this stuff alive and maintain it.
[00:19:19] Michael Chan: Awesome. Have you found that that kind of feeds back into the business as well?
[00:19:25] Michael Jackson: Oh, yeah, definitely. Definitely. So a lot of people will uh they'll show up on the on the open source code and they'll be like, hey, you know, like, thanks for working on this. And well, I mean, maybe maybe in the earlier days it it did a little bit more. Um, it felt like when the community was smaller, when there were like everybody was on the React Router repo, like everybody was in the issues and we were talking through things and we we I feel like we were all learning React together. And so, you know, you'd have people show up who were adopting it, who, you know, we would have like a little bit of back and forth with them. And then I think I think probably we've at least gotten a few workshops because of, you know, the fact that we work on the router. But but nowadays it's more just kind of like a- it's kind of more just like a tagline, you know, like we, you know, do React training. Oh, and by the way, we built React Router. Yeah. So it's it's but it's not It's not nowadays I'll show up for a workshop and it's not like these people have been in the React Router issues, you know, and working on it, but it's like they'll, you know, they're familiar with the router because they're using it at work. They've been they've seen the docs, you know, that kind of thing. So yeah, it does it does feed back into the business. I mean, I was just at, uh I did a workshop uh just this week at American Express in Phoenix. And uh and a lot of their developers were like, hey, you know, we'd love to hear about the router from, you know, the person who built the router. So that was that was pretty fun, you know, to kind of be there and like be able to tell them about. The thing that I'd made.
[00:20:47] Michael Chan: Yeah. I was at a conference just this last week and uh Lorie Voss of npm was was showing a bunch of charts and graphs and talking about kind of the the rise and fall and and takeover and death of all of these open source libraries based on based on the stats that they have from npm installs. And he was talking specifically about the router and kind of how it has this kind of paired success with React and how like the the the graphs are very similar after it was announced, how that kind of they helped each other kind of take off. And I found that I found that really interesting.
[00:21:22] Michael Jackson: It's crazy.
[00:21:23] Michael Chan: Yeah.
[00:21:24] Michael Jackson: It's it's it really is crazy. Like um I
[00:21:27] Michael Chan: mean it's kind of and this may be a terrible analogy, but I feel like Express, like everyone installs Express who has ever like used Node. And I feel like React Router is almost like kind of like the Express to to Node of of React. Like it's a it just gets used a lot.
[00:21:44] Michael Jackson: Yeah, it's it's kind of crazy how big the library is um and how big the install base is. Um I I remember uh you know kind of doing the math myself at one point uh you know and figured— about I think I think it was at the first React Conf, we figured that about 2/3 of uh people who who installed React were also installing React Router. And And I think it's- I don't know the numbers today, but I know it's probably not too far off. It's probably very similar. And and there was definitely an inflection point for React, uh which was uh when when we released React Router. Um and I think I think what changed for people was instead of you know instead of just building a view or a you know, a component in React. Uh, what the router let you do was actually build a whole site in React. You know, and and um, you know, that's what a good router lets you do. And and and now you you've tied the URL to the page content. And we were just, honestly, we were just taking our cues from Ember. Ember had a really good router back in the day. We were just taking our cues from them.
[00:22:52] Michael Chan: Yeah, that was a really hot topic at the time because I feel like they were driving the uh innovation of how a a client-side router could work. And it seemed like everyone else was just kind of like copying them. But like React at the time was just Vue. Like we only do the the Vue stuff.
[00:23:09] Michael Jackson: They said that. Yeah. I think they undersold themselves, but yeah, they said they said we're the V in the MVC. And I was like, you guys are more than that.
[00:23:17] Michael Chan: Is it very under-promise, over-deliver?
[00:23:20] Michael Jackson: Yeah. Which is, I mean, if you're gonna do it, like do that, you know, under-promise and over-deliver. So yeah, but but yeah, the like I say, the router was the thing that kind of took it as to more of, you know, it's not just the V now. It's like it could it could potentially be your whole app.
[00:23:36] Michael Chan: Yeah. You know, the router very specifically makes it takes it from just the view to being able to construct a whole application. And it's, you know, because you can get really far with setState, you know, in terms of state management, or if you have a good API, just fetching the API, but you still need to be able to kind of control, like re-navigate to routes.
[00:23:55] Michael Jackson: Well, and the router itself is actually pretty small. Like it's it's just a set of React components. Um, you know, we're we're we're we didn't we didn't, I mean, our our first versions, we had kind of a lot of our own API. Um, but uh, you know, to your point, you can actually go quite far with just components. And in fact, the router is just a set of React components at this point, I think. Once we figured out how to really use React components, um we looked at our API and we thought, you know, we could just do this whole thing with just React components. And it was funny though, Michael, because when we released React Router version 4 last year, I think it was like January, February last year, uh 2017, um we would tell people it is just components.
[00:24:44] Michael Chan: Yeah.
[00:24:44] Michael Jackson: And everybody was like, no. This is ridiculous. Like, how can I how can I do everything with just components? We got a lot of backlash. Yeah. A lot of backlash. Like, even from even from people who were like, you know, at at Facebook. Like, not not a lot of the people that that I, you know, really uh, you know, respect and admire. We actually got a lot of positive feedback from, you know, people like Sebastian and Dan, which was great. But there were there were some other people there and there there were some other people you know in the community who were like, this is ridiculous. Like you can't just do everything with with React components. Uh you know how are you gonna manage the scroll position and how are you gonna do you know? And and I think as a community collectively, hopefully we've gotten over that. And 'cause you see people doing all sorts of things with components now.
[00:25:35] Michael Chan: Yeah, yeah, yeah.
[00:25:36] Michael Jackson: Right, I mean, I saw um I saw uh Merrick Christensen last year doing like, I mean, at React Rally, remember he was like like parsing like— uh oh right, remember he was writing like—
[00:25:49] Michael Chan: Editor? Yeah, exactly. Yeah, yeah.
[00:25:50] Michael Jackson: With with React components, right? So like, yeah, you can you can do anything you want with a React component. But I think at the at the time, even just last year, it was kind of a radical notion that like the router is just gonna be a set of components. Yeah, that's it, you know, because because you still have other React libraries like, uh, you know, like, um, like Relay, for example, that is not just React components.
[00:26:13] Michael Chan: Well, you talk about how, uh, kind of React and the router, it was kind of this, for everyone involved, this period of learning and whatnot. Yeah, for sure. And that V4 API, um, was really interesting because it did kind of push the boundaries on like, can we just do this in components? Um, but I think also it pushed, um, It pushed composition in React to the forefront, right? That discussion of like how do we compose uh different components together in React. Um and that was um obviously a strong um a strong showing for the you know render props or function as children or whatever you want to call it. Um which eventually ended up being kind of the basis of the context uh API, at least the the public side of it. Um So it seems like there's a lot kind of going on at that time that kind of all coalesced into like this kind of mindset of components only being a really good way to write React apps.
[00:27:09] Michael Jackson: Yeah, yeah, definitely. And and the React team themselves have uh have uh have have kind of led the way a lot in this too. I feel like I feel like our work has kind of informed some of what they're doing as well. Um, you know, the the context API is is derived from uh from some work that I had done on a library called React Broadcast, which had a very very similar API. Just you'd give a value prop to your to your broadcast component, essentially, and then you would have a subscriber that would get that value out with a render prop and can use it to render stuff. And that was an API that that I developed specifically for React Router to get around the shouldComponentUpdate problem with the old context API. Right. And so that you know that was an idea that that uh that made it right back into React Core itself, which was it's it's just cool to see how like I guess you know an idea from the community can make it back and influence core React.
[00:28:01] Michael Chan: Yeah, yeah, that's awesome. So uh you mentioned Unpackage earlier. Uh tell me a little bit more about that.
[00:28:07] Michael Jackson: Yeah, so Unpackage is uh Unpackage is is this interesting thing. I honestly didn't— uh well, for people who may not know, uh Unpackage is uh it's it it is a CDN for everything on npm. Um, the the genesis of Unpackage is kind of a funny uh it's kind of a funny topic, actually, because um I I really didn't want to make my own CDN. Like I I just wanted— so people— so—
[00:28:36] Michael Chan: You didn't wake up one morning and be like, oh, I know what I want to do.
[00:28:39] Michael Jackson: Yeah. So people were showing up on the React Router repo and saying, uh hey, can you guys just publish a global build of React Router? And I was like, who uses global builds? That's dumb. Everybody just uses Webpack and da da da and just call it a day, right? And uh but you know, these people were using global builds and script tags. And and so I was like, okay, fine. We should have a we should have a UMD build of React Router available somewhere. Um and uh and so I went to look at cdnjs, which at the time was like the big CDN. Still is. They they serve it. Insane amount of traffic. And uh and I was like, okay, so how can I get something committed to cdnjs? So I went and I cloned the repo. And the repo took me- it took me about 25, 30 minutes to clone. Wow. And I realized, I was like, why am I why is this taking me 30 minutes to clone? Because everything that every file that is on the CDN is in the repo.
[00:29:42] Michael Chan: Every version too?
[00:29:43] Michael Jackson: Yes, every version of every file that is on the CDN is in the repo. And so I was like, uh, so I was I was literally cloning everything that you could get on cdnjs.
[00:29:53] Michael Chan: So you clone everything and then you would add like a specific build? Yeah, yeah.
[00:29:58] Michael Jackson: So so so after I had cloned it, like, you know, I went and had some lunch and then came back and the clone was done. So then I was like, okay, so I'm gonna add my React Router build to cdnjs, right? So I went and built the router. I checked out a branch. So checking out a branch on a repo of that size takes about 2 minutes. Wow. So I checked out a branch. I was like, okay, the branch is checked out. Add my file, make my commit, and then uh and then I submitted a PR to cdnjs. And uh and you know they showed up and they were like— I I I forget even the details right now, but there was something wrong with my PR. Okay. Felt like it was super nitpicky, right? Sure. Like they were just like, oh, you need to da da da da da. And I was like, really? Because essentially what you're telling me now is I need to go and spend like another 3 minutes just so I can check out that branch so I can like make that edit that needs to happen and then re-push my PR. Like it was just so heavy and and unwieldy and and hard to work with. And so I was like, I was like, you know what? I said, we're already publishing the UMD build as part of our npm package. It's already in our npm package. Because a lot of- the reason we included it in our npm package is because some people were- some people would would install, uh, you know, npm install React Router, and then they would uh, they would go and grab the UMD build from in from inside the package. Sure. And and put it in their HTML. So I was like, you know, we're already distributing it there. Um, why like why can't we just get it from npm? And I I was honestly, I was I was uh I was kind of surprised that you couldn't just get any file off of npm. Right. Like over HTTP. I was like, you know, they they they'll give you the tarball and they'll give you the metadata, but they don't give you a way to access individual files inside a package. And so I was like, well, like shouldn't be too hard to just build a little proxy. You know, I mean, that's what Node is for. Yeah. Node is for— it it it really excels at that, at building little proxy servers. So this was literally in an airport, um, while I was just waiting for my flight. I hacked together this little proxy in about an hour. And I put it up. Uh, I bought a domain, npmcdn.com is how it was originally put up. And this was probably about 3.5 years ago. Like maybe the first year that we were working on the router. So I bought npmcdn.com and I put up this little Node app uh on Heroku. And uh and I I remember like tweeting it out, telling people about it. And uh and I just said, you can you can use any URL you want. Like just plug in the package name and the version number and you'll get the file. And then somebody tweeted me back and they're like, dude, like why don't you have a homepage that can at least like tell me how to use it? And I was like, oh yeah, I should probably have a homepage on there. So, uh, so I put up a- so I threw up a little homepage that that kind of described how to use it. I remember like panicking 'cause I was like about to get on my flight. And so I was like, oh, put up a homepage. So I put up a little homepage and pushed that.
[00:33:12] Michael Chan: I mean, I think even today it's still-
[00:33:14] Michael Jackson: It's still just that page. Yeah. Yeah. It's still just that. I mean, I've added a little bit to the page, but it's, but it's still just that page pretty much. And uh and so I put that up. And I honestly thought like this this thing will just be sort of for those couple of weirdos who want to like load it from the UMD bundle. And I say weirdos lovingly because they you know they were using the router and and I'm just teasing. But but anyway, that's what that's what I thought. It's like this will just be for the very small group that loads things over you know using script tags. Um, and, uh, and then like the downloads started to increase, you know, and, and I was like, huh, maybe, maybe more people-
[00:33:55] Michael Chan: Maybe there's a lot of weirdos out there.
[00:33:57] Michael Jackson: Exactly. Maybe, maybe they're not so weird. Maybe they're, maybe they're actually like the majority of planet Earth, and maybe the people who are using webpack are weirdos, you know, and modules. Exactly. And, uh, And it just kind of kept going. And you know, I looked at the- I looked at, you know, I look at it today, you know, last month we did 9 billion hits, 9 billion downloads. So there are 9-
[00:34:25] Michael Chan: That's crazy.
[00:34:26] Michael Jackson: Yeah. And and and it's being used by like, there were there were almost, uh so there were like 800 million unique IPs accessing Unpackage, which is kind of a large chunk of humanity.
[00:34:42] Michael Chan: It sounds like that could be even more like people than just the number of IP addresses, right?
[00:34:47] Michael Jackson: Yeah, yeah. Well, oh, definitely, definitely, right? So yeah, so whenever you have, uh, you know, you have some network address translation that's going on, so you can have many IPs or many people actually sitting behind the same IP is what you're getting at. Yeah. So yeah, so yeah, it's it's hard to tell how many actual uh people it has that are that are using it. Obviously the number of developers is a lot smaller, but they're working on some pretty large sites apparently because we're getting a lot, a lot of traffic. Through to Unpackage. And so, you know, as I worked on it more, and uh and and you know, I've done some maintenance on it over the years. Um Cloudflare, by the way, I have to give a huge shout out to them, has stepped in in a big way. And uh they've just sponsored us from day one. They were just like- Thanks. You know, you guys are doing some awesome work. We want to sponsor you guys. So they hooked us up with a with a free enterprise account. And when I say us, I'm really just me. I don't know why I always talk in the we, but it's I've been working on it.
[00:35:38] Michael Chan: That's the entrepreneur in you talking. Yeah, exactly. We're doing some big stuff. Me and my big old team. There's some huge work going on.
[00:35:44] Michael Jackson: Exactly. And Heroku as well has been awesome. So they've uh they've you know sponsored us on the backend for the origin servers. Um and uh you know and and and it's grown and and it's people are starting to do some really cool stuff with it. You know last year, I had a little demo at React Rally where I introduced this uh this feature onto Unpackage, which let you load modules from the browser, right? So modules in the browser are a relatively new thing. And I think they're still fairly buggy and slow. Um, but you can actually have an import statement in your JavaScript. You can import, uh, you know, import some module name from a URL and it will work. The browser will actually go and fetch that file for you and and download the code and and execute it.
[00:36:32] Michael Chan: Crazy.
[00:36:33] Michael Jackson: Uh, yeah, it's it's awesome. Yeah.
[00:36:35] Michael Chan: The future.
[00:36:35] Michael Jackson: Yeah. Oh yeah. It feels like the future. Yeah. And um and so I demoed this this feature, and it was only available in uh I think the latest like Chrome Canary at that at React Rally last year. Here we are a year later, and it's available in a lot more browsers. Obviously, you can use uh web they call them web modules in in in the browser. Um and I demoed a feature about a year ago that that essentially downloaded all of D3 uh using web modules. And and You know, if you trace the D3 uh request graph back, it turns out that it it was it was something like 700 different modules, like 700 different HTTP requests.
[00:37:15] Michael Chan: Crazy.
[00:37:16] Michael Jackson: Um, but I did it over the conference Wi-Fi at React Rally, and it actually loaded the page and it worked.
[00:37:21] Michael Chan: Wow.
[00:37:21] Michael Jackson: Um, which was yeah, which was pretty cool at the time. And I was thinking, uh you know, at the time I was just like, like there has to be something here, you know, there has to- and and since then, I've seen quite a few other tools come out, like the Polymer team, for example. Um, that's that's their story for for how they how you deploy software in in Polymer is you use web modules. Yeah. And uh, you know, you don't they they they don't really go the webpack route as far as I can tell. I haven't used a lot of Polymer, but that's— and and they're loading all a lot of code on webcomponents.org uh just using modules. They're loading a lot of it from Unpackage. Um and so it's it's kind of this movement where I'm starting to think, well, maybe it's not just for weirdos. Maybe like uh you know it's actually maybe it's actually the right way to do something. I mean, because when you think about HTML— and sorry, I feel like I'm talking way too much. No, no, no. The the API for building a web app is you build a You build an HTML page, right? And and you put some script tags in it and you put some style tags in it. And and uh you know we kind of got away from that when when we started using build tools. And I don't want to sound like some old fogey like reminiscing for the old days, because I I'm I'm not. I'm I'm looking towards the future here. But I'm I I do think that that is a great API for building stuff. You know, where you can say, um, you know, I'm actually very, very sad that the HTML imports uh spec died because I think that was a great way to build stuff as well, right? You can, where you can declare things right in HTML and say, here's what my application needs. Mm-hmm. And HTML is currently treated as kind of like a second-class citizen in, at least in my opinion, in in a lot of uh in a lot of apps these days. Yeah. It's it's kind of just like the byproduct or the artifact of what you- you know, you generate some HTML eventually, but but you don't really like look at it or understand it or or use it in your programming. Um, but I I I think it's I I I think it's interesting. I I think it's important because it is it is literally the entry point for your app. So anybody who's coming into, you know, development for the first time, or maybe even you've been here for a while and you just want something that you can understand a little bit easier. Um, that's a a a nice, straightforward way to get into building an app, is to write an HTML page. Okay, now I need now I need some interactivity. Now I need some JavaScript here. Um, why can't I just put a script tag, you know, instead of treating it like a like an artifact, like a side effect.
[00:40:03] Michael Chan: And it goes back to kind of how how we both got into it, like just putting a Perl script in your CGI bin or putting a PHP file up there.
[00:40:11] Michael Jackson: Yeah, it does. It does.
[00:40:12] Michael Chan: It seems like a better progressive path for someone who's just kind of coming onto the scene today to start with a little bit of HTML. Like you said, I want some interactivity, be able to use React, like use the module just like all the tutorials show, but without having to have this huge kind of behemoth knowledge of how modern applications are built and served and and all that.
[00:40:34] Michael Jackson: So so the so the really cool thing that we have now that we didn't have back then was we have modules in JavaScript, right? And so Um, you know, there's this problem with, you know, how do I get dependencies on the page? So I can import my own scripts pretty easily, but how do I get dependencies on the page? And so that's where I feel like Unpackage could be really useful to somebody who's developing, you know, with a- if they're if they're using HTML and they're using JavaScript modules today, um, how are you gonna get, you know, your dependencies on the page? Well, you can either stick Uh, you you know, if if you're not using— so first of all, if you're not using modules, you can load your um, you know, the UMD bundle of React, for example, from uh from Unpackage, from the React— uh and they've got uh install instructions on their on their website. You can uh install the UMD bundle of React. Or if you are using uh modules, uh web modules, you can use an import statement. You can use a script type equals module and just use an import right there in your HTML file. And import uh the files that you need. So it's it's kind of interesting, actually, because React, uh right now they only ship two builds. They only ship CommonJS and UMD. Um so you can't actually load React using uh an ES module, uh uh using the browser's native like import statement. Um I've been kind of hounding them about it for a while. I I think we'll get it in there eventually. But um, but uh, but but that's a, you know, that's a that's a really viable strategy for building something. And if that is the right API, couldn't we start with that API and then work from there to get all of the cool stuff that we've got today? Right? Because because I know some people are rolling their eyes thinking like, oh, this is so inefficient and he's ignoring-
[00:42:22] Michael Chan: Sure.
[00:42:22] Michael Jackson: —bundling and code splitting and all the cool stuff that we can do these days. And I and I know we can do all of that cool stuff. Why don't we start with that API and then do all that cool stuff? You know? Like, why don't we start with an API that's not a config file?
[00:42:37] Michael Chan: Yes.
[00:42:39] Michael Jackson: You know?
[00:42:40] Michael Chan: Yep. So that sounds like an exciting future. Do you have anything else that you wanted to mention that we hadn't talked about yet?
[00:42:48] Michael Jackson: No, man. I'm good.
[00:42:50] Michael Chan: Good.
[00:42:51] Michael Jackson: Yeah, I'm good.
[00:42:52] Michael Chan: So uh so last question. You started this uh this trend. But um what uh projects are you excited about or people you follow that are doing great work?
[00:43:01] Michael Jackson: So I have to give— uh uh I mean this is an old project that a lot of people know about, but I have to give a huge shout out to uh Henry Zhu and uh the Babel team, Logan Smyth, all those guys. They're they're doing uh incredible work. And I it's it's just not— the the way that the JavaScript community is supporting them is just not enough right now.
[00:43:26] Michael Chan: And for how much it gets used. Exactly. Yeah.
[00:43:28] Michael Jackson: Yeah. It is it is JavaScript basically at this point. And some and again, people are gonna roll their eyes at that too, but it is like you use it, we all do, we all use it. I mean, that's something that-
[00:43:40] Michael Chan: I mean, the developers of the the language, like the language is moving forward because people can test these features in production using using Babel.
[00:43:49] Michael Jackson: Yeah. And it's and it's uh it's such a huge part of the language and Henry is devoting himself full-time to working on that project. So. So if you have any way of uh of you know pulling some strings at the company that you're working at to get them some extra funding, I'm sure they would greatly appreciate it. They they uh they really need it. And and most of all, they deserve it. It's uh it's such a valuable project for all of us.
[00:44:14] Michael Chan: Yeah.
[00:44:15] Michael Jackson: Um other stuff that I'm uh excited about, I'm particularly excited about um I'm really excited about the work that uh Sebastian and Andrew are doing with uh with Suspense. And I'm hoping that it's gonna drop this fall at React Conf. And again, that's something that's— I it's it's it's not really like a secret or anything that they've been working on it, but it's um I think it's gonna change a lot of things.
[00:44:44] Michael Chan: I agree, yeah.
[00:44:45] Michael Jackson: I think it's gonna change a lot of things. Just the ability to uh You know, we we talk about co-location of uh code, right? And and React sort of co-located a lot of things for us. We got our state right there. We got our markup right there. Um, you know, you've got your click handlers, whatever, right there in the same component. Um, and uh and Suspense, I think, is gonna allow us to co-locate even more. So we can co-locate things like Uh, you know, fetches for code and fetches for styles and and uh and uh you know lots all sorts of async things uh that we can co-locate right there with our markup, which, you know, I I was having dinner the other day with— uh I was having dinner the other day with uh Jordan, uh Jordan walk, the the uh creator of React up in Seattle. He actually took me out to this really nice steakhouse. It was amazing.
[00:45:40] Michael Chan: Which one?
[00:45:41] Michael Jackson: It was called uh Metropolitan Grill on 2nd in Seattle. Oh my gosh, dude. I walked in the I walked in the door and there was like pictures of, you know, Arnold Schwarzenegger and like President Bush and like President Clinton, like all the, you know, all these celebrities and famous people are up on the wall. And I'm just like, what am I doing here?
[00:45:59] Michael Chan: Yeah.
[00:45:59] Michael Jackson: Um and I anyway, I had dinner with uh with uh with Jordan and um he was he was you know, I was asking him, I was like, what do you think is, you know, kind of the ideal API for, you know, for data loading? And he's like, I just wanna- I just wanna declare my data right there, just right there in the markup. Yeah. Where it's needed, you know. I don't wanna put it somewhere else, not even- not even in a different place in the same component or in a different file, you know. I just wanna put it right there.
[00:46:28] Michael Chan: Yep.
[00:46:28] Michael Jackson: And, um, and it kind of clicked for me. I was like, you know, that's exactly what I feel like Suspense is going for. They're putting uh they're putting the yeah just putting the putting that basically declaring that dependency uh right there in line. So I'm really excited about that, really excited to see what what uh comes comes out of that. But um but again, those guys already have plenty of money. They're working at Facebook. So if you've got money, go go support Babel.
[00:46:53] Michael Chan: Well, awesome. Uh thank you so much for your time today, Michael. It's always a pleasure. Talking with you. Excited to hear about the the future of uh what Unpackage uh could be for us and uh the projects you're excited about.
[00:47:07] Michael Jackson: Yeah, dude, thanks for having me on my podcast, on the podcast. It was fun.
chantastic.fm