Building React Primitives to Power In-App Messaging

This ad is not shown to multipass and full ticket holders
React Advanced
React Advanced 2026
October 23 - 26, 2026
London, UK & Online
Upcoming event
React Advanced 2026
React Advanced 2026
October 23 - 26, 2026. London, UK & Online
Bookmark
Rate this content
Sentry
Promoted
Code breaks, fix it faster

Crashes, slowdowns, regressions in prod. Seer by Sentry unifies traces, replays, errors, profiles to find root causes fast.

Get started

At Knock we power real-time in-app messaging experiences via our React SDK, enabling product teams to drop in components and have fully featured in-app notification feeds, modals, banners, and more instantly available. In this talk, we'll take a look at how we structured our React library in a composable way, giving teams the power to use our components out of the box, override styling with their own tokens, or bring their own UI components via hooks. We'll dive into how we structured our SDK to provide maximum flexibility for engineering teams, while preserving ease of maintenance.

This talk has been presented at React Summit US 2024, check out the latest edition of this React Conference.

FAQ

Knock helps product teams power user-centric cross-channel notification experiences, including emails, push notifications, SMS, Slack, and in-app experiences like notification feeds.

Chris is the CTO of Knock.

Knock powers all of Vercel's in-app and email notifications, such as notifications for failed builds.

Knock uses a React library, a set of hooks, and a real-time service for building in-app messaging experiences.

Yes, Knock can be integrated with other frameworks like Vue or Svelte.

The components provided by Knock are highly customizable. Users can override styles and customize components to fit their design systems.

Knock allows teams to own the components rendered in their apps, enabling them to focus on performance and optimization rather than relying on HTML injected over the wire.

More information about Knock can be found at their website noc.app or by visiting their booth.

Knock provides pre-built components like banners, modals, cards, and notification feeds that support both light and dark modes.

Chris Bell
Chris Bell
8 min
19 Nov, 2024

Comments

Sign in or register to post your comment.
Video Summary and Transcription
Hi, everyone. I'm Chris, the CTO at Nock. We help product teams power user-centric cross-channel notification experiences. Today, I'll talk about extending the abilities of our in-app messaging and how you can power any kind of in-app messaging using our platform. We optimize for flexibility, customization, and a shallow learning curve. Our pre-built React components include a banner, modal, card, and notification feed. All of this comes out-of-the-box, supporting light mode and dark mode. Easily show modals and announcements with no additional code. Own the rendered components for performance and customization. Build custom components with minimal code. Use hooks for fetching data and real-time updates. Noc provides a schema for strong data integrity.

1. Building React Primitives for In-App Messaging

Short description:

Hi, everyone. I'm Chris, the CTO at Nock. We help product teams power user-centric cross-channel notification experiences. Today, I'll talk about extending the abilities of our in-app messaging and how you can power any kind of in-app messaging using our platform. You can build modals, banners, and toasts mapped to your own components. Nock powers the data layer, providing real-time in-app infrastructure at a large scale.

Hi, everyone. I'm Chris. I'm speaking today about building React primitives to power in-app messaging. I'm the CTO at Nock.

Just a quick introduction to what Nock is in case you haven't seen our videos outside. We help product teams power user-centric cross-channel notification experiences. Think about things like sending emails, push, SMS, Slack, all those kind of good things. But we also power in-app experiences as well for things like notification feeds. I'm sure a bunch of you in this room and beyond have actually used Vercel. One fun fact about Nock is we power all of Vercel's in-app and emails. So if you've ever failed a build on Vercel, those notifications come via Nock. This is a really good example of the kind of in-app experience that you can currently build with the Nock platform, which is basically we power all of the backend, the real-time service, and then we give a React library and a bunch of hooks so that you can actually build your own UI on top of it.

But today, what I want to talk to you about is how we've been extending the abilities of our in-app messaging way past actually just doing those kind of notification feeds. So what we're doing today is actually bringing the ability so that you can power any kind of in-app messaging, whether that be, you know, maybe it's a modal or a banner or like a toast that pops up to your users. And all of that is mapped to components that you own and that you introduce into your codebase. And Nock powers the data layer when we're doing that, and you actually get the benefit of our real-time in-app infrastructure that currently handles millions of users across billions of API requests. So lots of scale.

2. Approaching SDK Updates for Introducing Changes

Short description:

But today, I'll talk about how we approach the SDK updates for introducing changes. We optimize for flexibility, customization, and a shallow learning curve. Our design includes a low-level client SDK, hooks for React libraries, and out-of-the-box components built on top of Radex UI. These components are accessible and customizable, allowing you to override styles and match them to your product. Our pre-built React components include a banner, modal, card, and notification feed.

But what I want to talk about today is a bit about how we actually approach the SDK updates for introducing these changes. So we actually set out with some design principles about how we would introduce this. So we really wanted to make sure that we are optimizing for flexibility around use cases. So thinking about customers who are using these pre-built out-of-the-box components, but also people who are coming and building custom components on top of what we're providing, all the way through to Shocker for this room, people who are using other Vue frameworks that aren't React. And maybe they need to bind in and do something inside of Vue or Svelte or something else like that.

And we also wanted to make sure that everything is super customizable. So if you're using our out-of-the-box components just as they come, you can override all of the styling and bring your own kind of design system and set of styles to it. And then lastly, we wanted this kind of shallow learning curve, so making it really easy for folks to get started with the components that we provide. So it's the minimal amount of changes within your code base to get up and running with these pre-built out-of-the-box components.

So here's a bit about how we approached our design. So this slide is not a stack, but if you kind of imagine it as a bit more of a stack, this makes more sense. At the bottom, we have our low-lying SDK, which is our client SDK. That is a low-level wrapper that actually exposes plain JavaScript classes and then manages all of the kind of business logic associated with in-app messaging. When should that message show? Who should it show to? Marking it as read, things like that. That's backed by a store that we actually use TANstack Store for, which is fantastic because it gives us this kind of cross-Vue platform ability to bind into these state updates. Really, really neat.

Then, next, we actually expose a set of hooks that make use of that low-level client. That's what our React libraries can consume. Those hooks make everything nicely reactified, makes it really easy to bind to that state store so you can receive these updates. Then, finally, at the top of the stack is a set of out-of-the-box components that we provide. Those are built on top of Radex UI, the primitives that it provides. Make sure that we have a nice set of accessible components out of the gate. Then, we also deliver these kind of smart and dumb components. The smart component binds to our hooks, provides all the functionality. These dumb components are more of the view layer whereby folks can come in and maybe you want to use our modal, but you want to override the way that the button works or some other facet of the modal, and you can do so. Then, everything inside of here, you can actually update the CSS variables or the classes can be overridden. It's really easy to kind of match it to whatever styling that you have within your product.

Cool. Here's a little look at what our pre-built React components look like. We provide a banner, a modal, a card, this notification feed as well.