All right, good afternoon. My name is Mark Erickson, and today I am very excited to talk to you about what's new in Redux Toolkit 2.0.
A couple quick things about myself. I am a senior front-end engineer at Replay, where we are building a true time-traveling debugger for JavaScript. We've got a booth out there in the lobby. If you haven't seen it yet, please come by. We'd love to show you how much easier it makes debugging applications.
I will answer questions anywhere there is a text box on the internet. I collect all kinds of interesting links. I write ridiculously long blog posts. I am a Redux maintainer, but most people know me as that guy with the Simpsons avatar. I know. Sometimes I wear a name tag just so people recognize me.
Redux Toolkit is the standard way to write Redux logic today. It provides methods to simplify standard Redux patterns, like creating stores, writing reducers, funcs, and even data fetching. It includes a sub-piece called RTK query, which is specifically meant to simplify data fetching in Redux apps, and it wraps around the Redux core APIs.
We released RTK 1.0 in October 2019, which if you think about it means it's been around half as long as the original Redux library, and yet, many people don't know about it. The latest version has been RTK 1.9. We shipped 1.9 a year ago. The latest patch release was 1.9.7.
At the start of this year, we began work for RTK 2.0, and we had a few different goals. The first is correct ES module common JS compatibility, whatever that actually means. We wanted to modernize the JavaScript build artifacts so that they use modern syntax, no longer targeting IE 11. We wanted to add some new features, remove some deprecated APIs, and we wanted to ship some updated TypeScript types along with the packaging.
Now, unfortunately, it turns out that this whole ESM common JS thing is really, really hard. I went through multiple rounds of iteration where I tried to change some settings, tried to change some build configuration, and multiple tools would not work right. It turns out that the package exports field is really complex, but the bigger issue is that every different build tool has their own idea of how they interpret these things. I was actually messing with this in the speaker's room an hour ago. It's not done yet. I actually ended up writing a very long blog post a few months ago, talking about the pain and suffering that I've dealt with trying to get this stuff to work.
Comments