The Whimsical Potential of JavaScript Frameworks

Spanish audio is available in the player settings
Rate this content
Bookmark

When it comes to building whimsical interfaces, React is a surprisingly capable ally. In this talk, I'll show you how I use React to orchestrate complex interactions by digging into some examples from my blog.

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

Watch video on a separate page

FAQ

The main difference lies in the design elements used. The Stripe product's dashboard is simpler without whimsical elements like mesh gradients or floating globes, focusing on functionality for a business-to-business SaaS product. In contrast, the landing pages feature interactive and dynamic design elements such as 3D globes.

The Stripe dashboard uses React, as identified through DevTools which shows that the page is built using React.

No, the Stripe landing pages do not use React. They are primarily built with vanilla JavaScript and custom packages, without relying on any component framework like React, Vue, or Angular.

Stripe's landing pages are known for their interactive and dynamic features, such as a 3D globe that changes as you scroll, indicating it's a 3D model and not just a video.

In a B2B SaaS product, the focus is often on functionality and usability rather than aesthetic embellishments. Whimsical design elements, while engaging, may not be necessary or could potentially clutter the user interface, detracting from the product's practicality in a business context.

The talk aims to explore how JavaScript frameworks, particularly React, can be used to create engaging and whimsical details in web development, enhancing the interactive experience of websites and applications.

A practical example is the interactive Like button described in the talk, which features animations such as the heart rotating based on cursor position and the eyes moving independently, adding a playful and engaging element to the user interface.

Josh Comeau
Josh Comeau
28 min
13 Nov, 2023

Comments

Sign in or register to post your comment.

Video Summary and Transcription

The speaker discusses the whimsical and detailed work of Stripe, particularly their interactive and dynamic pages. They explain the use of React for building whimsical details and tracking mouse position. The speaker introduces React Spring for smooth animation and React3 Fiber for creating a 3D egg model. They also mention the use of Framer Motion and React server components for animating CSS properties.

1. Introduction to Stripe's Whimsical Potential

Short description:

The speaker discusses the whimsical and detailed work of Stripe, particularly their interactive and dynamic pages. The speaker compares the Stripe product's login page to the rest of the pages, highlighting the absence of whimsical flourishes. It is revealed that the dashboard uses React, while the landing pages do not. The speaker explains the reasoning behind using React for a data-driven and full-stack application.

So, I should warn you, the first two minutes are going to be unavoidably bright. The rest of the slides will be dark, but brace yourselves. I'm a big fan of the work that Stripe does. I find it's really whimsical and detailed. I remember when this mesh gradient came out and it was a big deal. But all their pages are really interactive, dynamic. You have this 3D globe that you first might think is a video, but then it changes as you scroll, so it really shows that it's a 3D model. Very, very cool stuff.

When you actually log in to the Stripe product, though, it's a bit like stepping through a door into a different universe. There's no mesh gradients. There's no floating globes. That's not necessarily a bad thing. Like, you know, it's a business to business SaaS product. You don't necessarily need a bunch of whimsical flourishes. But my point is that just looking between the two, right? It's very clear that it's a different product built by a different team, using different tools.

And it probably won't surprise us to learn that the dashboard uses React. So, if you have the DevTools, it'll tell you this page is built using React. And the landing pages are not. They do not use React. I've seen the dev team talk about the tools that they use. It's a lot of vanilla JavaScript and, like, custom packages but no component framework. No React, no Vue, no Angular. I think this makes sense. Like, you know, we think of React. Like, this looks like a React application. It's data-driven. It's full-stack. It's all the stuff we've been talking about. And so you might reasonably wonder, like, why would you want to use React to build something like this? And that's what I'm here to talk about today. This talk is called the whimsical potential of JavaScript frameworks.

2. Building Whimsical Details with React

Short description:

The speaker shares their use of React to build whimsical details, such as a cursor-tracked heart and playful Like button. They explain the inspiration behind these details and discuss the concept of their blog as a personal playground. The speaker also introduces the idea of building an egg shape and focusing on cursor tracking for head rotation and eye translation.

And I want to share how I've been using React to build some pretty playful, whimsical details. I also realized I don't have a water, so I'm going to steal one of these while we let my very fun title screen play out.

So, for those who don't know, I have a blog. I blog at JoshWComo.com and when I built this blog, I sort of figured that this was going to be my playground. So I was going to indulge all of the whimsical ideas that I had. So if there was like a playful idea I wanted to do, I was going to do it. This, I was sort of inspired by those, like iron shavings you get with a magnet and you move the magnet and the iron shavings ripple around. It's exactly the sort of like kind of pointless, but fun little detail that I say yes to when it's my blog because it's my own little playground and I can do whatever I want.

One of the little details, and I'm gonna zoom this way, way in. Oh, this part's also, let me, hold on, dark mode. This little fella down over here, there's a bunch of little details to it. It tracks your cursor, so the heart itself rotates depending on your cursor position. A little bit more subtle, the eyes move independently and I don't know how clear that is, but small thing. If you come near the Like button, but then move away, if you don't engage with it, he gets a little bit sad. Because, you know, he's a Like button, Like buttons like to be clicked, but he doesn't stay sad very long, I decided to make him very cheerful. And, of course, you can click on it. I wonder if I have sound, let me see. That's fine, it makes a little glug noise, you can imagine that. And if you keep clicking it all the way, eventually, you get to the top and you get a little pop of confetti. A little Easter egg that people don't know. You can right-click to remove Likes. You can have fun with that.

So, this is essentially what I want to talk about. There we are. We're going to build this, we're going to build an egg. I chose an egg because it's a slightly simpler shape. And we're going to focus on the cursor tracking, so the head rotation and the eye translation. Now, even before we get to React, right, what are the things that we have to know to build this sort of interaction? Well, I need to know where in the viewport the cursor is. And the way we typically do this is by measuring the distance from the top left corner in pixels. So as you move more to the right, your x-value gets higher.

QnA

Check out more articles and videos

We constantly think of articles and videos that might spark Git people interest / skill us up or help building a stellar career

Emotional & Functional UI Animations in React
React Day Berlin 2022React Day Berlin 2022
28 min
Emotional & Functional UI Animations in React
Today's Talk discussed the importance of UI animations in React, both functional and emotional. Examples were given using CSS and Framer Motion, with a focus on user feedback and accessibility. Design guidelines and animation usage were highlighted, as well as the consideration of negative emotions in animations. The Talk also touched on designing 404 error pages and concluded with gratitude to the audience and organizers.
JavaScript Haikus: My Adventures in Tiny Coding
JS GameDev Summit 2023JS GameDev Summit 2023
27 min
JavaScript Haikus: My Adventures in Tiny Coding
This Talk is about writing super tiny JavaScript programs, known as tiny code. It explores the concept of code golf and the use of a live editor for instant feedback. The Talk discusses various ways to share tiny code, including Twitter.net. It also covers creating graphics, games, and sound in a small space. The speaker highlights inspiring tweets and showcases examples of tiny code, including asemic writing. The future of tiny code includes new techniques, better browser support, and AI-assisted programming.
AI + UX: Product Design for Intelligent Experiences
C3 Dev Festival 2024C3 Dev Festival 2024
28 min
AI + UX: Product Design for Intelligent Experiences
AI design challenges include bias, safety, and security. Trust and transparency are important in AI. Design principles for AI include user control, fighting bias, and promoting good decision-making. AI can enable the design process and investors expect to see it included in products. AI empowers individuals to create and share ideas, but managing expectations is crucial.
Domain Driven Design with Vue Applications
Vue.js London 2023Vue.js London 2023
14 min
Domain Driven Design with Vue Applications
Top Content
Welcome to this talk on domain-driven design in Vue.js application. Today we are going to look into domain-driven design, its benefits and how it works with Vue.js domain-driven design versus the MVVM model. Vue.js thrives in domain-driven design, a design approach that models software to match a domain. DDD emphasizes understanding business logic and creating a domain that reflects the language and concepts. Integrating DDD in Vue.js offers benefits such as effective modeling of complex business domains, structured code reflecting domain logic, and easier onboarding and ownership.
Proven Pinia Patterns
Vue.js London 2023Vue.js London 2023
20 min
Proven Pinia Patterns
Top Content
Pinnia is a lighter, more modular state management solution for Vue apps, offering consistent patterns, TypeScript support, and an intuitive developer experience. PINIA encourages splitting state into manageable domains, improving code splitting, type inferences, team collaboration, and debugging clarity. Pinia provides flexibility in accessing and mutating state, with different approaches for option and setup stores. It also offers features like patch, reset, and onAction methods. Vue Mastery offers comprehensive Pinnia courses and resources for fast learning.
Component Design Patterns
Vue.js London 2023Vue.js London 2023
18 min
Component Design Patterns
The Talk covers clean components and when to create new components, as well as patterns for writing cleaner components and the benefits of VIP patterns. Refactoring and separating code into separate components can make it shorter and easier to read, reducing complexity. The importance of not repeating oneself and the benefits of using smaller components for performance and developer experience are discussed. Composables can help extract logic in large and complex components, and patterns can be incorporated into component libraries and design systems.

Workshops on related topic

How to make amazing generative art with simple JavaScript code
JS GameDev Summit 2022JS GameDev Summit 2022
165 min
How to make amazing generative art with simple JavaScript code
Top Content
WorkshopFree
Frank Force
Frank Force
Instead of manually drawing each image like traditional art, generative artists write programs that are capable of producing a variety of results. In this workshop you will learn how to create incredible generative art using only a web browser and text editor. Starting with basic concepts and building towards advanced theory, we will cover everything you need to know.