AG Grid's New React Rendering Engine
React Summit 2022
My name is Niall. I'm the guy who started the AG Grid project. It's great to be here. And today I'm going to be talking about the new React rendering engine that we have in AG Grid. Now before I start, just a quick intro to what AG Grid is, in case some of you don't know. Up here is a small example using AG Grid. This example has got, hold it up, one, two, three, sorry. This example has got 10,000 rows and 1,000 updates per second. So those flashy lights that you see are the 1,000 updates per second coming in. Now we're an enterprise component. So we come with lots of cool enterprise type features. Like turning your screen black. So this is row grouping. So we've grouped the data. And you notice that at the group level, the numbers are still, sorry, the group levels have the sums of the values underneath. So 1,000 updates coming in per second, 10,000 rows, and the groups are being re-computed in real time inside the browser. So grouping's pretty cool. We also do some other really, really cool stuff like this here. This is charting directly from the grid. So if you want to have your application chart like this, you just put in AG Grid, and you don't write any more code, all this stuff comes for free. So the way I like to see it is pretty much AG Grid puts your app on steroids. We often get asked the difference between AG Grid and React Table. Before I say that, is Tanner still here, in the audience? Tanner, is he gone? No, he's gone. Oh, he's had his Q&A. If there was an award for somebody who's contributed most to the React open source community, I'd have to say that would go to Tanner with TanStack. It's just amazing with React Table, React Query. It's pretty cool. But myself and Tanner, we decided to work together because AG Grid and React Table are different things. You see, AG Grid comes with a lot of stuff out of the box. It has a UI. It's very powerful. It's like all guns loaded. And that's brilliant when you're writing enterprise applications. React Table does not have a UI. You have to create the UI yourself. It takes more code. But sometimes, less is more. And less is more when the pages that you're delivering have to go on the web. Research engine optimization is something that you're worried about. So if you want a lightweight library that's on the worldwide web, then you should consider React Table. But if you want an enterprise component for an enterprise application, then you should consider AG Grid. Right. What was my talk about again? Right. As a component developer, we have a challenge. How do we support all of the different frameworks without having to write our application again for each framework? Well, we worked out that all these different frameworks, Vue, React, Angular, they all do exactly the same thing. They all result in DOM and CSS. They have to, because that's what the browsers understand. The difference is how they go about it. So what we decided to do in AG Grid is make our components as simple as possible. All our components do now is have a template, and they set CSS styles and classes. They don't know why. They just set these up. All the intelligence is inside this shared services that we have in AG Grid. Then when we bring AG Grid to a new framework, like in React, what we can do now is rip the rendering engine out that we have and put a React rendering engine in instead. So now when you're using AG Grid in React, it's using React 100% all the way through the grid. Now that's best explained with a demo. And to help me with the demo, I'm going to invite on stage one of our best developers, Mana. So give it up for Mana. Mana can do lots of wonderful things, including holding microphones. This feels way above my pay grade. OK, so this is the example that we saw earlier on. But this is live on my laptop. You can see here there's a product column. This is AG Grid. It's written in React. This application is in React. And this is the code. So the grid would take a bunch of columns like this. You can see that the first column is the product column. What I'm going to do is configure that product column to use a React component. So in your app, you could provide a component like this. This is a simple React component. It's just showing an image. Oops, I'm using a touch pad. It's a bit tricky. An image and a value. I'm going to put that into the first column here. Hit Save, go back to my browser, refresh, pray, and it works. So the dancing little robot here, that's in React. But it gets really interesting if I bring up the DevTools and go to the React component section. I'll click out the inspector, pick my new component. And you can see here on the right-hand side, that this application provided React comp lives inside our AG grid cell comp, which lives inside the AG grid row comp. And so forth and so forth up the hierarchy tree until we get to the grid and we get to the application. So it's using React all the way from your application, into React, and into the customizations for AG grid. And that's it. So thanks very much for your time. Enjoy the rest of your conference. Take care. Thank you.