55: Erik Rasmussen on Final Form
This week we sit with Erik Rasmussen to discuss forms in React.
We talk about his library redux-form and it's evolution to final-form — a framework agnostic approach to making dynamic forms easy.
Along the way the talk open source maintenance and monetization struggles.
If you've wanted open source fame, this is a good one to listen to.
Featuring
Links
- GitHub Sponsors — Fund your work. Build what matters.
- Forms — React Docs
- Redux Form — The best way to manage your form state in Redux
- Flux — Application architecture for building user interfaces
- react-final-form — 🏁 High performance subscription-based form state management for React
- vue-final-form — 🏁 High performance subscription-based form state management for Vue.js
- frontier-forms — Data-driven forms that let you focus on what matters: your application
- Build forms with GraphQL — 2019 React Europe talk by Charly Poly
- "Let a hundred flowers bloom"
- CodeFund — Ethical Advertising
- Seek Justice Podcast — A weekly deep dive into Criminal Justice with Erik Rasmussen and Dennis Schrantz
- Happy Hour — A candid and open weekly discussion between Dennis and Erik over drinks
- 💥 Introducing.... 🏁 React Final Form HOOKS!! 💥
Sponsors
GitPrime
GitPrime turns historical git data into easy-to-understand insights and reports that help engineering teams succeed. gitprime.com
Transcript
[00:00:00] Michael Chan: This is React Podcast. I'm Chantastic. Welcome, React friends. This week we sit with Erik Rasmussen to discuss forms in React. We talk about his library Redux Form and its evolution to Final Form, a framework-agnostic approach to making dynamic forms easy. Along the way, we talk open source maintenance and monetization struggles. If you're interested in that sweet, sweet open source fame, this is a good one to listen to. Before we dive in, I want to take a minute and thank GitPrime for sponsoring this episode. GitPrime has a book they want to give you. It's called 20 Patterns to Watch for in Your Engineering Team. It's really good. It will help you identify and fix failing engineering strategies like code hoarding, bit twiddling, and unusually high churn. They have 20 of these, hence the name of the book. And uh you need to read it. Now, you might be thinking, this sounds like a book for managers. And to that I say, no, this is a book for leaders. And you, my friend, are a leader. There's been a lot of internet chatter this week about being a 10x dev, most of it nonsense. But I can tell you one thing that always makes you a more valuable contributor: the ability to communicate well and identify bottlenecks. If you want to level up your engineering game, read this book. It is a spotlight on issues your team is most assuredly facing. When you take this book book, shine a light on them, and hit them head-on, you'll look like a natural leader as you address those issues and improve effective collaboration. Visit gitprime.com/20patterns, that's the number 20 patterns, for your free copy. GitPrime, engineers build business. Eric, welcome to React Podcast.
[00:01:56] Erik Rasmussen: Thank you very much. I'm a longtime listener.
[00:02:00] Michael Chan: I'm happy to have you back. I'm gonna I'm just gonna be super honest. We recorded before and we talked a ton about uh open source sponsorship and monetization and how difficult that was. And then, like, you you made some some some brilliant thoughts about how like GitHub was uniquely poised to do this.
[00:02:20] Erik Rasmussen: Yep.
[00:02:21] Michael Chan: And then like 2 weeks later, it's like you're a prophet. Like everything you said kind of like came true.
[00:02:28] Erik Rasmussen: Yeah.
[00:02:28] Michael Chan: You know what, that didn't age very well. We should probably uh probably re-record this.
[00:02:34] Erik Rasmussen: Yeah, yeah, yeah. When you- that's the problem. That's the problem with being a prophet is you got to uh have a quick release cycle on your podcast. Otherwise you otherwise you look like you're cheating.
[00:02:44] Michael Chan: So apart from being a prophet, what are you up to right now? Where are you working and what are you working on?
[00:02:51] Erik Rasmussen: Well, uh my day job is at a company in North Carolina where I do not that interesting stuff using Java and uh and some old uh JavaScript libraries.
[00:03:06] Michael Chan: Stuff that pays the bills.
[00:03:07] Erik Rasmussen: Stuff that pays the bills. It's not um it's not it's not all that exciting, although I have little by little been able to pull some React uh into into my my day job and build little smaller web apps using like Next.js or something to accomplish a task.
[00:03:24] Michael Chan: Cool.
[00:03:24] Erik Rasmussen: Little by little, we're sneaking the uh some green into the brownfield. But um it's uh but it it it pays the bills. And um and as for open source, that's sort of just a a side hobby of mine that um I don't know, for some reason, despite— uh I I don't know, I find it really rewarding. Yeah, um it's I can't really put my finger on why it is, but people are actually grateful for uh for code that I've written in a way that your uh your your corporate bosses often aren't.
[00:04:05] Michael Chan: Yeah, absolutely. So now, that that brings up an interesting question. Is like how how did you get into this space if you're not using it at work? So how did you get into the the the form in React, you know, Redux, open source space, if this is not something that is part of your work?
[00:04:23] Erik Rasmussen: Right. Well, I mean, side projects. We all have side projects, and I had a side project that was going to be, well, it it was gonna require a form where, it a complicated form, like the sort of thing where you're like you're filling out your your resume or your LinkedIn profile, right? And a LinkedIn profile is a complicated form.
[00:04:47] Michael Chan: Yeah.
[00:04:48] Erik Rasmussen: So there was a whole bunch of of questions and you had to you know be able to add uh different you know work experience or or education experience and that was pretty complicated. And I was already sort of building using React and some other side projects, so clearly I wanted to use React because I could see that it was the one true way. Uh and I started looking into how to build forms in React and how to manage form data and the React docs are not not very helpful. The React docs tell you, look, this is how to manage the to to manage one input. You keep your your value in state and then you have a controlled input and they don't say anything about, oh, and if you have other inputs, then maybe do do it this way.
[00:05:36] Michael Chan: Yeah, they tell you all of the the the anatomy of like form elements, but not like, hey, this is how you actually construct a form in React.
[00:05:45] Erik Rasmussen: Right. And if you've got more than one input, you know, you're gonna have to raise that state up to some container component or some some system like that. And so I it was just like like I think most open source libraries get started as it's a problem that the author needed to solve, and it was clearly a relatively generalizable problem because every web app practically has a form.
[00:06:15] Michael Chan: Yeah.
[00:06:15] Erik Rasmussen: And at the at the time, also, when I was starting when I was doing that, uh Redux was just about was it was really just before Redux got officially launched, but I was I was paying attention to the um to the React Reactiflux uh chat area, and I could see that You know, this was the time right after Facebook had said, oh yeah, we have this great architecture that we call uh Flux, and here's a here's a picture diagram of how it works, and here's here's no code to do anything with it. And so everyone uh that was around at that time went out and wrote their own Flux implementation with their stores and their actions and stuff, and uh I certainly wrote my own. Because it made sense as a way to get state from down deep in the tree up to up higher to let it sort of trickle down.
[00:07:12] Michael Chan: What was it what was it called, by the way? Your Flux implementation, did it have a did it have a Back to the Future name like all the rest of them?
[00:07:21] Erik Rasmussen: No, it didn't. In fact, it was it was only for my own project. It wasn't I didn't try and open source it or or anything. Uh, I don't know, it was just called Stores or something, who knows, something stupid. Uh, but, so I saw Redux was taking off and I thought, well, you know, I need a way to manage a bunch of state and Redux is being billed as the way to manage state in your application. And so, I even in the in the ReactiFlux, I I asked uh Dan, I said, is there Uh, I I can't update my my I can't dispatch an action and update my Redux state on every single key press, right? That seems like way too way too much. And and he came back and said, I don't see I don't see why not. Uh, try it. And so I that's what that's how Redux Form got started. It was just a little reducer that took, you know, change and blur and focus uh actions and the field name and then sort of kept your form state in in a Redux object. And I was surprised how quickly everyone descended upon it and found it as as and clearly needed a form solution for React.
[00:08:37] Michael Chan: Yeah.
[00:08:37] Erik Rasmussen: There was there just weren't any. And again, this is just when React was really becoming popular. People were finally getting over the uh the HTML and JavaScript living together. And uh and Redux Form became quite popular and I guess I sort of kept with it. It was sort of a fun problem to solve. This was new territory, really, and people gave me all these different use cases. Like whenever you open source something that solves one little problem for you, you everyone comes and says, oh, this is so close to what I need to do, but I can we just add this one? Config parameter so it slightly behaves this differently in this other way. And it sort of grew and grew in popularity and uh and unfortunately in in bundle size.
[00:09:24] Michael Chan: Kind of balloons out of control once you get too many hands in the pot.
[00:09:27] Erik Rasmussen: If you yeah, if you keep saying, yes, I'll add your little thing, yes, I'll add your little thing, yes, I'll add your little thing, eventually you get 1,000 uh config parameters.
[00:09:38] Michael Chan: This is something that I've I've I've actually heard I've heard talks about, we've talked about on the show quite a bit, is that You know, as a new kind of open source, you know, creator, maintainer, you want to you want to say yes because, you know, you've got people's attention and that's very exciting and you want to be able to say, oh yeah, we can totally make this happen. But it feels like there comes a point in every library where you've now lost the spirit of whatever you're creating, um that that now it's it's no longer easy or or fun or whatever. It has so many, it has it's it's burdened with configuration, which is like one of our least favorite things to try to parse through.
[00:10:19] Erik Rasmussen: Right.
[00:10:20] Michael Chan: So so that was uh Redux Final Final Form, correct?
[00:10:24] Erik Rasmussen: No, that was Redux Form.
[00:10:25] Michael Chan: Oh, sorry, Redux Form. So that was Redux Form. How did that uh kind of like migrate into uh Final Form today?
[00:10:32] Erik Rasmussen: Okay, well, with Redux Form, I got quite a bit of feedback from from the community. And some of it was things like, well, people are using Redux with Angular and other frameworks. Uh isn't your isn't Redux Form really just a reducer? Why can't we use it with with other frameworks? And the answer to that was that it's actually it was pretty tightly coupled to the React Redux um binding.
[00:11:00] Michael Chan: State cycle, yeah, yeah, yeah.
[00:11:02] Erik Rasmussen: Yeah. And And also, people people were complaining about the bundle size. It was just enormous. And other people wanted uh render functions to do your your fields and your form and stuff. And the way Redux Form was written, it wasn't that wasn't really possible because of the way it was using uh React.createElement. And anyway, there were some some nitty details there.
[00:11:28] Michael Chan: So it was tied too closely to React and Redux specifically.
[00:11:32] Erik Rasmussen: Yes, yes. And also, um, well, anyway, there there was quite a bit of of feedback, um, and I thought about how I could potentially, you know, make a better form library. And it it took me quite a while to of just thinking about it, but then I then it occurred to me, what if you could have a form library that was just The thing that managed your form state. It didn't care about where what framework you used or anything like that. It just knew how to have a collection of fields and and take focus and blur and change events and update the values of those fields and have validation and do all of these things that all forms everywhere need, even on on all on all devices, really. Um. What if that could just be in pure JavaScript, and then you could build a little wrapper around that for React or for any other framework? And so that's how Final Form came to be. Uh, it's, I I, because I had all this experience in all these use cases of what of what people need forms to be, I was able to, I really, I sort of, I built the API first. The outer shell of the API and using using Flow to uh strongly type it, I was then able to go and actually make it so that it all worked and I had all these tests these tests from Redux Form that I could make it verify that it all worked. And so that's sort of how Final Form and React Final Form were born.
[00:13:13] Michael Chan: Interesting. So did you start a fully new project or did you start it as like trying to pull the guts out of, you know, React Redux- or sorry, there's so many project names, I keep I keep bubbling them up. Uh, did you start to-
[00:13:28] Erik Rasmussen: Redux Form.
[00:13:29] Michael Chan: The guts out of Redux Form and kind of use that as a starting point for-
[00:13:33] Erik Rasmussen: No, I didn't, because the whole- because I didn't build- it's not built with a reducer in mind. Because of the functional nature of the reducer where you got your state and your action and then you get your new state. It's it didn't really didn't really work like that. Like I I considered building sort of a uh internal reducer inside, but um instead I went another way that's slightly more imperative uh coding in the JavaScript, but it um it uh like the internals of the engine don't really matter that much as long as it Sure.
[00:14:14] Michael Chan: Is Redux Form something that you still maintain or have you moved fully into the Final Form suite of products?
[00:14:21] Erik Rasmussen: Yeah, I I I tried for a little while to maintain uh Redux Form, you know, in to the level of uh merging pull requests and doing releases and stuff, not really fixing any bugs because, you know, software is never complete, but Redux Redux Form has enough users that I feel pretty confident that most of the use cases are are handled. Mm-hmm. And so, yeah, little by little I sort of started pulling back from that, and a couple months ago I found uh someone that is going to make keep on maintaining that and doing that that level of work, because I got so focused on the new thing that I really- whenever I had to just make a decision on the on the old thing, I had to go and relearn how that how Redux Form was built and how it was doing things. I wasn't it wasn't in that right mind space.
[00:15:15] Michael Chan: Yeah. Now, I've I've actually heard this a lot. When I talked with Kent, he was you know he he sunsets projects like pretty quickly and um or or hands them off. And I this seems— I I am not an open source uh you know open sourcer or whatever you know people call themselves who who create uh awesome open source projects. It seems like there comes a point where you really have to ask yourself, you know, if you're the best steward for this library that you've created, you know, no matter how much you like it or how valuable it was to you at the time. Um, because, you know, like you said, it's hard for you to get back into that mind space.
[00:15:51] Erik Rasmussen: Yes, for sure.
[00:15:52] Michael Chan: And do this thing that maybe someone, you know, really needs and really wants and would be able to to shepherd that. How does that how does that feel as someone who's created something but then kind of is in a position to have to pass it off.
[00:16:04] Erik Rasmussen: Yeah, I mean, it was, you know, it was my baby for a while, but you gotta let the- you gotta, you know, kick the little baby bird out of the nest at some point. Uh, that's sort of a bad metaphor, but, uh, yeah, I, I think that our community is, is richer for people that can, can do that, can spawn the right idea, because, and then maybe let other people maintain it. Like, they're they someone that's good at at you know getting a startup off the ground, for example, isn't necessarily the best CEO when when they come when they when you IPO, right? So there's a there's a different set of skills. Like, for example, um I haven't finished listening yet, but you recently had uh Michelle— uh
[00:16:51] Michael Chan: Yeah, with Strata.
[00:16:54] Erik Rasmussen: And uh and he just at React Europe uh blew everyone's mind with this new idea of a way to do GraphQL um stuff, and then said, you know, at the end of his talk, look, I don't have the— uh I I don't have the the time to to maintain this. This is just an idea that I came up with. Somebody else take this and run with it. Uh which is which is awesome. I love that there can be people you know creating those sparks and then someone else can go and fan the flames.
[00:17:23] Michael Chan: Well, this is the same thing with Flux in general, right? I mean, they Facebook said, hey, we have this idea, this is how we do it, we we we don't really even have a fixed system for doing this.
[00:17:34] Erik Rasmussen: That's a good point.
[00:17:35] Michael Chan: This is your idea, like this is the idea, go do whatever you need. And uh you know through that became you know you know Redux and and uh a bunch of other kind of framework-like things for React. Or agnostic framework type ideas and uh kind of morphed into kind of our our workflows today, which might not even involve uh Redux, but still has those core ideas of you know a reducer and immutable state and all that kind of stuff.
[00:18:02] Erik Rasmussen: Right, exactly. With the with the useReducer hook, it's pretty much in React now.
[00:18:06] Michael Chan: Yeah, yeah, between that and context, it's like it just kind of made its way into React, which is which is really awesome to see. I mean, that was a I don't know, like a 5-year journey from kind of like Facebook saying like, hey, this is a thing that we do, and then every everyone making one of those, and then it kind of like kind of uh filtering down to pretty much Redux, and then now Redux is in React.
[00:18:28] Erik Rasmussen: Yeah, and that's that similarly, we're we're seeing all this competition in the GraphQL space of who's gonna write the best GraphQL uh client and server and stuff. And like that's- apparently Facebook has already solved that problem to their um to their level of of contentment and at at Facebook, they have their own way of doing things. But I like that they share this idea of, let's let the ecosystem fight this out and see what um what the winning architecture is at the end.
[00:18:58] Michael Chan: Yeah. So I want to jump back to uh to Final Form, the library, for a second and um just ask you, how are you kind of architecting support for the different platforms now. So you have you have Final Form, that's kind of the the core of this.
[00:19:13] Erik Rasmussen: Yes.
[00:19:13] Michael Chan: This idea. And that's just uh you know JavaScript uh objects and arrays kind of observing blurs and focus and inputs. And that can be used anywhere.
[00:19:22] Erik Rasmussen: Yep.
[00:19:23] Michael Chan: And now you have uh wrappers for the different platforms that you might use. So what does that what does that look like?
[00:19:29] Erik Rasmussen: Right. Well, I When I when I launched, I I launched it with React Final Form because React is my favorite um mm-
[00:19:40] Michael Chan: Library, tool, UI?
[00:19:42] Erik Rasmussen: Framework, yeah, yeah, podcast. Uh, and uh, it's so, that's I sort of think in React now when I'm just when I'm designing UI, but it was but it was clear to me that uh it could be used elsewhere. And It took a while. Like, I I sort of put this thing out there and I said, look, somebody else come and write your own your own um thing to your own bindings to to something else. And one of the first ones was Vue, because Vue was becoming popular uh at the time and and still is. And uh somebody wrote a a way to connect it to Vue. I've I've still never written any Vue, so I don't really understand fully understand how that works, but So, there's a Vue one and uh like a year later, somebody wrote a web components, uh a way to hook up uh to manage your form state from web components in Final Form. And I've heard some some of the some people in the in the issues have mentioned that their that they have their company has their own proprietary uh Vue wrapper around it.
[00:20:49] Michael Chan: Oh, nice.
[00:20:50] Erik Rasmussen: Uh, and it's just recently I I noticed that if you look at the um at the npm download charts, uh first, you know, the the uh Final Form and React Final Form start out really together and then at some point, Final Form takes off and and um React Final Form sort of holds holds steady with growth, but clearly someone else is using it with something other than than my React wrapper. So, and the but the and the React wrapper is literally just managing uh when you when when the component mounts, it's it um when the form mounts, it creates this this form instance and puts it in the context. And then when the fields mount, they they ask for the form in the context and register themselves. And So it's all it's all just um there's very little actual code in React Final Form, that's why it's the the bundle size is so small. It's all about converting, it's it's all about knowing about React Synthetic Event and how to get the value out of that and and give it back to to Final Form, because Final Form doesn't doesn't care.
[00:22:03] Michael Chan: So I I have a question about this this model. Is is React Final Form Is that something that is just kind of like there's there's only one way to do it, or are there opinions baked in that someone might not share and maybe go off and build their own kind of React Final Form uh version?
[00:22:20] Erik Rasmussen: As the author of React Final Form, I thought there's no way, there's no reason that anyone would want to, at least not start building on top of React Final Form, to use Final Form in React. Boy, that's a complicated sentence. Uh, but I was pleasantly surprised at this year's uh React Europe to see to see someone, uh Charly Poli, I think is how his name is pronounced, who has built a thing called React Apollo Form, which which combines, which sort of marries uh forms and and GraphQL, and he's doing this this stuff where it's like doing introspection on the GraphQL to sort of to create your form, uh to build your form, and know what the fields are, and I guess do some validation on the on the typing or something. I I haven't actually attempted to use this thing, but it looks really cool.
[00:23:22] Michael Chan: Huh, interesting.
[00:23:23] Erik Rasmussen: And uh which is which is great. That's that's why I I made the decision that I did to keep the libraries separate. Um, ah, I just remembered, one of the other complaints about Redux Form was how, like, the bundle size got so big because all the features were added to the to the to the main package, the main bundle, right? And so there's a lot of stuff in there that if you're building a login form, you don't necessarily need all the stuff to manage complex arrays of of form of fields and things. And one of the other design goals of Final Form and React Final Form was to have sort of a plugin architecture where you could build your own form library from from pieces. And so if you don't need complex field arrays, then you don't have to install that. But but when your project gets to the point where you need that, then you there's just this thing you can plug in and install. And it's been really it's been really cool to see how how there's different ways, there's different form uh structures that can be built using this this system of uh sort of plugins that I that I enabled for Final Form.
[00:24:44] Michael Chan: Yeah. So are there challenges with this type of architecture that you've experienced, like the having a core and then having a bunch of different adapters?
[00:24:53] Erik Rasmussen: Uh, yes. The primary challenge is sometimes there will be a- I mean, one of the- let's start with one of the benefits. One of the benefits is you can have Final Form and React Final Form uh installed, and there can be a bug fix down in the core of Final Form that will fix things, and you only have to upgrade that one library because it's Uh, because it didn't that change didn't affect Final Form. And it's kind of cool that even even like the the type descriptors can are uh will flow through React Final Form. And the however, sometimes you fix something uh or you in order for a feature to be available in React Final Form, something has to change in Final Form, which means keeping the dependencies in sync. Like, sometimes sometimes a change in React Final Form will require an upgrade to Final Form, and it can get a little bit messy in managing the two different version uh systems. It's not like, you know how uh the the Babel team, for example, uh the when they when they change a version, they change a version for all their all their little bits, even even if they maybe the the code hasn't changed in those, but it sort of keeps them in line. Um and I suppose React and ReactDOM itself does the same sort of thing.
[00:26:21] Michael Chan: Yeah, so how are you organizing that? Is that all just uh like different repositories, or do you have it kind of pulled in as a monorepo like uh you know Babel and some of those other projects?
[00:26:32] Erik Rasmussen: I wish I had set it up as a monorepo. Uh I'm feeling some pain with the with having them all separate. Uh but they are under a a common GitHub organization.
[00:26:43] Michael Chan: Organization.
[00:26:44] Erik Rasmussen: Yeah.
[00:26:45] Michael Chan: Cool. I'm sure that that does help. And and are the packages released under an an npm organization or are they all separate?
[00:26:52] Erik Rasmussen: Not yet, but uh I when the community starts to uh also support this new way of of publishing things on GitHub, uh where GitHub does force all of your stuff to to be under an organization.
[00:27:12] Michael Chan: Yep.
[00:27:12] Erik Rasmussen: Um, so I I've noticed uh the React Testing Library, for example, um has already has already switched over to have— it it went from not having an organization to having an organization recently. Um, so I think eventually that's gonna that's gonna be the way it is and it groups all the stuff together in in in your package.json nicely and um but not yet, but soon.
[00:27:40] Michael Chan: Yeah, it's it there's a lot of uh nice advantages, but it ha it is hard if you kind of had a library before some of these uh these patterns were popular. Um I think that Babel moving to that style was like a really big shift in uh I guess, making it uh reasonable. I think a lot of people were were scared of installing like @whatever packages, and I think that now it's it's kind of starting to to actually be the opposite now where you realize like, oh, this package is actually maintained by the the organization that maintains the other packages, and so hopefully it'll be released or considered at the same time. It's um it's hard keeping up with those kinds of things, isn't it?
[00:28:19] Erik Rasmussen: For sure, for sure. And one question I've received one time at a conference was, uh so you've got this in a in a GitHub organization, who else is in the organization? And I've had to say, well, it's it's just me, I just did that to bunch to bundle this stuff together in the same place in in GitHub. But uh
[00:28:38] Michael Chan: it's an organization of one.
[00:28:39] Erik Rasmussen: Exactly.
[00:28:42] Michael Chan: So I wanted to transition a little bit into uh what it's looked like for you to maintain open source while working. First of all, how do you kind of find the time to do this in a project that isn't kind of like actively being used for work?
[00:28:58] Erik Rasmussen: Yeah, um, I don't know, it's uh an hour or two here or there. I can I can look and go check the um issues and PRs. Really, it's to the point where I look more at PRs than at issues because there's enough of a community of users that will that will help on questions that are that are issues. Um, and and some yeah, it's uh I I find the time when I can. It's I don't have I don't I can't say a particular amount of hours every week that I get to put into it, but um.
[00:29:33] Michael Chan: Yeah, it kind of requires like a a variable amount of time, huh?
[00:29:36] Erik Rasmussen: Yeah, and it's it it it's a hobby. It's something that I that I like that for sure isn't paying any bills. Um. And it's just when I when I can.
[00:29:48] Michael Chan: Yeah, so last time we chatted, we talked a little bit about um kind of open source monetization and the difficulty there, um and and right after that, GitHub announced that they were going to be kind of uh jumping into that space and making it a little bit easier to contribute, um or or sponsor, or kind of help some of these open source maintainers and creators. Is that something that excites you? Does that add anything valuable over kind of the options before? Obviously, this is something that you you had suggested. GitHub would be like the perfect place for this. Um, what's your excitement level about that?
[00:30:28] Erik Rasmussen: Yeah, so, I can't see, I can't see with a library of my size ever having enough support to You know, have that be my full-time job, even though I would I would I would love that very, very much. Um, but for sure, when I started getting a little bit of income from uh what used to be Code Sponsor that turned into Code Fund, uh where with advertising on the Redux Form uh web uh docs pages was generating a very small amount of money, but it was it was monthly uh monthly revenue, that I I certainly felt more motivated when I when I was when I had Final Form mostly built and I was sort of going through a little bit of burnout with that, and I saw that I was getting money from from from Redux Form, I thought, all right, well, uh I'm I'm gonna go ahead and go ahead and finish this and get it out the door. Um, as for GitHub, yeah, they are, I still think that GitHub should have some sort of ad model that's- I know people people really get upset when I when I when I mention that. Uh you know I don't want banner ads on my on my on my repo. Uh but I think the internet has shown, and you know television and radio before that, that the there's a really sound business model if you're producing content to have it be free with uh with with advertising rather than paid. Like no one no one goes and and no one says, I'm gonna go listen to this I'm gonna go listen to to this podcast, but every episode costs you know $2 or something.
[00:32:16] Michael Chan: Sure.
[00:32:16] Erik Rasmussen: No one's gonna no one's gonna listen to that. Uh and I think I think there's more there's more money in having people see it see an ad than asking for donations because the donate button uh isn't really good for much.
[00:32:32] Michael Chan: Yeah, it's you know it's really interesting. I've I've actually had a similar uh problem with uh with this show or similar challenge with this show in that um trying to figure out how to monetize it and yeah, donate or kind of Patreon or any of that kind of stuff was just not something. I it's tricky because like I think a lot of people want like an added value, right? It's not just like, oh, I like this show, I'm gonna like kind of support it. And I'm the same way. I I mean, I have, it's very difficult to separate me from my money.
[00:33:00] Erik Rasmussen: Right.
[00:33:01] Michael Chan: And so like, so that's really hard. And like, I didn't, I just didn't have anything that I could, you know, reasonably add without making this the show prohibitively difficult for me to produce every week. Kind of like thinking about the show and then also like an ad. And so I definitely empathize with the problem and it does feel like, um, kind of advertising really is is that space where like a lot of people can just ignore it, um but then it also gives you you know a little bit of value to kind of keep doing the thing that you you want to do every day.
[00:33:32] Erik Rasmussen: And not only that, but uh developers, the kind of people that are looking at API docs all day, uh we are really good eyes to get in front of your ads because, uh for example, a lot of the A lot of the folks that advertise with with Codefund are uh like infrastructure, uh you know logging your errors and stuff on your server and stuff and things like that, which if you if you're doing a uh a SaaS product that is for uh engineers or something, yes, the developers are the ones that are that are potentially making those decisions or at least can surface those to their to their uh to their bosses, but also I think Developers are uh just, you know, we're we're uh we're nerds that like uh expensive little gadgets and stuff. I like it would, I can see that there that there could be potential for advertising other things, not, you know,
[00:34:30] Michael Chan: yeah,
[00:34:31] Erik Rasmussen: you know, starting with like a smartphone case or something and and going up to some new uh little gadget that does that does something cool.
[00:34:40] Michael Chan: We like pricey stuff, we like free stuff.
[00:34:43] Erik Rasmussen: Right, exactly. And developers also uh have fatter wallets than most of the people bumming around the internet. So uh we you know we're we can buy, we have spending money more so than than your average internet browser, I would think.
[00:35:00] Michael Chan: Yeah, well, that's that's super interesting. Yeah, it's you know it definitely continues to be a challenge that is hard to solve and I think it's hard, I I I think, I I know for me it was really hard to kind of actually like bring on you know sponsors and advertising onto the show just like philosophically. But that's just, I think once I got over that, I realized kind of like what you were saying, that's just that's just part of the process, right? Is is that if if you wanna support something, it's hard to like actually get money for the thing that you're doing. Right. It can be valuable for a lot more people to say like, hey, when you when you have this problem and you need to solve this need, go over here and like, you know, you've already heard it 100 times, like this is the product that you know,
[00:35:42] Erik Rasmussen: right,
[00:35:42] Michael Chan: that you need.
[00:35:43] Erik Rasmussen: Yeah. And and that's, you know, good brand advertising is, anyone that listens to podcasts knows about, you know, Squarespace.
[00:35:50] Michael Chan: Right.
[00:35:52] Erik Rasmussen: And
[00:35:52] Michael Chan: MailChimp.
[00:35:53] Erik Rasmussen: And MailChimp. Yeah, they were the big ones before. And uh I mean, let's see. Yes, the the it makes a lot of sense for the the whole um sponsor the month, you know, some like with um Open Collective and those guys, where you can say, I want to give, or Patreon, I want to give so many so many dollars a month uh to to this project. That's that's great, but yeah, again, Corporations are just bigger versions of us that don't want to part with our money. And, you know, how many- like, if you if you think how many man hours have have code that I've written and open-sourced saved, you know, the global economy, you know, there's there's an awful lot of money there and and value, and not not money, value. Uh, but you can't charge for for an open source thing, because then a competitor will pop up for and undercut you, or, you know, or be free. And also the whole idea with open source, I mean, you know, there's there's two definitions of of free. There's, you know, free as in speech and free as in beer. Uh, and open source has been has been both for for a while. And you can't, if you're gonna allow people to read through your source, you can't then charge them money to to use it, because they can just literally copy and paste and and have have your have your source code.
[00:37:22] Michael Chan: Totally.
[00:37:23] Erik Rasmussen: That's that's a um that's a stumbling block, but I I don't know, we'll see uh where it goes. It'll be interesting over the next 5 or 10 years to see what open source turns into and if we have, you know, people that shine really brightly and burn out so often as as is is currently the case, or or what happens, I don't know.
[00:37:44] Michael Chan: Yeah, well, I mean, I think it's worth worth noting as well that, you know, the more successful or like at least the self-sustaining open collective projects are actually heavily funded by by companies who consider that advertising.
[00:37:59] Erik Rasmussen: Yes, yes.
[00:38:00] Michael Chan: Um, so that's, I mean, that's kind of bringing it back to that like advertising space. It's it's kind of like a a a workaround, um, but like the ones that are successful really have had to take on like pretty big um uh you know higher level incomes, I guess, from you know bigger companies who see it as like a chance to get in front of developers as like a sign of goodwill, etc.
[00:38:21] Erik Rasmussen: Yeah, exactly. The um that's if if uh if a company wants to sponsor a repository, for example, and get their logo on the on on the top of the README or whatever, that's great if they're looking to hire the kind of people that are that are that know enough of React or whatever to use this particular library. That seems, yeah, job job ads seems like a great a great fit. I mean, that's that's how Stack Overflow uh you know became profitable, I think.
[00:38:52] Michael Chan: Yeah, yeah. Cool, well, I know that you have some other hobbies going on in your life. You got uh 2 podcasts. Uh why don't you tell me a little bit about those, what what you're doing that isn't tech related?
[00:39:05] Erik Rasmussen: Yeah, so a couple months ago I started uh 2 podcasts with a with a friend. Uh my friend is a uh he's a career-long uh criminal justice reform wonk and has worked with uh with state governors and stuff to to reduce prison population and and help with recidivism and things like that. And Uh, that's not really a thing that I was particularly interested in, but every time I would get together with him, uh, he would, he would start talking about this stuff. And it was just fascinating to hear him talk and hear the nuance, and immediately I had questions. And so I, um, I said, hey, why don't we start a podcast? Because this is sort of an interesting thing to talk about and and listen about. And so we created a podcast called Seek Justice. It's at seekjustice.fm. Uh, and you can go there and listen. It's not- there's no tech involved. It's um, but it's an interesting topic. And then it's an interesting problem, especially in the US with uh, with incarceration, with over overpopulation in prisons.
[00:40:14] Michael Chan: Yeah.
[00:40:14] Erik Rasmussen: There's a- it's a it's a big um, it's a big problem. And then with the with the same friend, I've got another one that's just sort of a silly one where we make each other laugh and have fun. And talk about our lives and stuff, uh and that's called Happy Hour uh at happyhour.fm. And so we would appreciate any listeners, and, you know, obviously Patreon patrons would be would be nice too. But uh we don't have any advertising yet, but um we got to get our viewer numbers up a little bit higher first. So everyone stop this podcast and go go listen to that.
[00:40:48] Michael Chan: happyhour.fm, that's a that's a A solid domain.
[00:40:52] Erik Rasmussen: Yeah, I was pleased to uh to acquire that.
[00:40:55] Michael Chan: Yeah.
[00:40:56] Erik Rasmussen: Yeah.
[00:40:57] Michael Chan: Do you do you also have a domain acquisition issue? A lot of people on the show do.
[00:41:01] Erik Rasmussen: Uh, you mean like a bunch of domains that I've acquired for projects that I have never started? And uh yes.
[00:41:10] Michael Chan: Yep, that's the one. That's the that's the one.
[00:41:12] Erik Rasmussen: Uh-huh. We need we need to come up with a a name for that, like domainitis or something.
[00:41:17] Michael Chan: I know, we need to you know what we need to do is we need to come up with some type of thing where it's like Every time you you buy a domain, you also support you know a a podcast or open source or whatever.
[00:41:27] Erik Rasmussen: Right.
[00:41:28] Michael Chan: You already got your wallet open. Exactly.
[00:41:30] Erik Rasmussen: Yes. Awesome. We should briefly go back and talk about Hooks.
[00:41:36] Michael Chan: Oh, yeah, yeah, yeah. Yeah. Um, so let's let's jump back in and we'll talk about Hooks. I was gonna ask if there was anything that you wanted to end with, so this is this is perfect timing.
[00:41:45] Erik Rasmussen: Yeah. So uh when when Hooks came out, obviously it was amazing and blew all of our minds. Um, and with that same, I guess maybe the following day, because that that uh that re announcement was late at night in in Spain where I live. Uh, the next day I I I may I sort of I rewrote uh React Final Form using using hooks, because like I said before, React Final Form is really just a thin layer over the Final Form engine. And it was really like, it was um it was like 45 lines of code or something, uh after being prettified. And it was it was just very a clean way to— um to because with React Final Form, what it is is it's it's subscribing to this other sort of third-party non-React- thing, right? Uh, which is what, you know, useEffect is is good at for, you know, event listeners and things. Uh, so, I I did that just sort of as a proof of concept. And then, uh, I had my, a lot of my library consumers were uh complaining that, uh, the the way I was using the context API was not very good. And and they were they were getting warnings when they were using strict mode and stuff about- because I was using uh component will receive props or one of those other um deprecated lifecycle methods. And so I sat down and I rewrote all of React Final Form in uh using hooks. And I was very pleased with how how much how it just made more more sense. Like before, when you Um, when you mounted your your form, it would go and create the the final form instance. And then, like I said before, the indiv- all the individual uh fields would register and get updates. Uh, and before, I had to have all these different lifecycle methods where I had to unregister and re-register if you changed if you changed some way of the of your your config parameters. And so with um with with hooks and useEffect, it just sort of, I I could say these are the things that if they change, I need to unregister and re-register. And also because Final Form was already using the subscriber observer pattern of when you subscribe, you get a function back that is gonna unsubscribe. Which happens to be the the same pattern that uh useEffect wants. So it all just really came together in a very nice way. And then just when I was about to release that, it occurred to me that really any component uh that is injecting state using either either a higher-order component or a or a or a render prop, Um, any component that is really, let's see, any component that is managing state and then and then providing it to you, when written with hooks, you can take all of that code and extract it out into one custom hook that does all of it, right? And then you could, and then I was able to export that. So, uh, there's a, Now there's a field component that all it does is call useField and gives you that state. And then there's also a useField hook that you can potentially import to make your own field component in whatever way you wanted to. And that's when that occurred to me, that was um that was intense to understand that uh in much the same way, you know, Michael Jackson famously said, Anything you can do with a higher-order component, I can do with render props. And he and he pretty much proved it. And um and I think anything you can do with- not not exactly. It's not true that anything you can do with hooks, with a with a render prop, you can do with hooks, because that's that's not true because uh your hook happens outside um outside of your JSX, if that makes sense. So for example, an important part of React Final Form that I haven't mentioned yet is that it was built from the ground up to be able to specifically uh subscribe to changes to different parts of your form state and not have to re-render the whole form on every single value change, for example. And so one and but one thing that you can't do with hooks so much is control the re-renders. Inside your JSX. Once you get once you once you get to your return statement and it's all JSX on the all the way down, including render props and things, um you can't you can't put hooks in there, right? So you can build your own you can build your own separate component that where in which case the use field will control the rendering re-rendering of it um as the same as field does. I don't I don't know if people are able to follow what I'm saying here, but um.
[00:47:07] Michael Chan: Well, it seems like it-
[00:47:08] Erik Rasmussen: Hooks are awesome.
[00:47:08] Michael Chan: Composes really nicely with hooks, that you can kind of like add your own layers of abstraction, and that feels really natural in a way that it it it hasn't in the past.
[00:47:17] Erik Rasmussen: For sure, for sure. The the lifecycle methods, you know, they were an okay solution to the problem at the time, but uh hooks are so much more flexible and reusable and composable and stuff.
[00:47:29] Michael Chan: Yeah, cool. Well, I'm glad that you uh you brought it back to that, because I think hooks are, uh understanding how like every library uh integrates with hooks is um is critical. Uh is there anything else that you want to kind of leave us with before we go? Any more uh prophecies?
[00:47:45] Erik Rasmussen: Let's see. Uh no, uh just uh keep up the good work. I enjoy this podcast every week. So thank you.
[00:47:54] Michael Chan: Oh, thank you. Thank you. Well, it is good to to to to finally have you on. And uh and and we got we got two conversations out of it. So uh so thanks for being on. Uh, I appreciate your time.
[00:48:04] Erik Rasmussen: You should publish the other one for Patreons only or something. Nah, just kidding.
[00:48:10] Michael Chan: That's a good idea. That's a good idea.
[00:48:12] Erik Rasmussen: Yeah, behind the scenes.
[00:48:14] Michael Chan: Cool. Well, thanks, Eric.
[00:48:15] Erik Rasmussen: Yes, thank you very much. Talk to you later.
[00:48:17] Michael Chan: Thanks for listening to React Podcast. This has been episode number 55 with Erik Rasmussen, and I'm Chantastic. Thanks to our sponsor this week, Get Prime, for making this show possible. Visit getprime.com. That's the number 2-0 patterns to get their free book, 20 Patterns to Watch for in Your Engineering Team. It will give you the insights you need to lead your team to new heights of productivity. 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