Lessons Learnt from Building Interactive React Applications

Rate this content
Bookmark

When users directly manipulate onscreen objects instead of using separate controls to manipulate them, they’re more engaged and more readily understand the results of their actions. Subtle animations can give people meaningful feedback to help clarify the result of their actions. But, the devil is in the details. What often seems simple can be complex to get right, especially when you care about accessibility. Sid shares the lessons he has learned building interactive UIs.

FAQ

Sid has been focused on front-end development, particularly animations, design, gestures, and drag and drop functionalities.

While common aspects include design clarity and fast loading times, the use of motion or animations to provide context is often overlooked but can significantly enhance user experience when used tastefully.

Animations can provide users with context and a smoother interactive experience, making the interface feel more intuitive and engaging.

The concept behind 'Saturday' is a social media platform that is only accessible on Saturdays, featuring a feed of posts from friends and various interactive elements.

Using animations when loading new posts can help maintain the user's sense of place in the feed, making the experience less disorienting and more contextually aware.

Optimistic updates involve assuming that an operation like posting a comment will succeed without waiting for server validation, immediately reflecting the change in the UI, which enhances the responsiveness and fluidity of user interactions.

Exit animations should be shorter to quickly clear the screen once the user decides to close or exit, enhancing the responsiveness and keeping the user experience snappy.

Frame of motion simplifies the integration of complex animations with component libraries in React applications, offering APIs that manage animations efficiently and intuitively.

Siddharth Kshetrapal
Siddharth Kshetrapal
35 min
14 May, 2021

Comments

Sign in or register to post your comment.

Video Summary and Transcription

Animations can enhance the user experience and provide context in interface design. Using frame and motion in React can create smooth fade-in effects and improve navigation. Optimistic updates and instant comment appearance can eliminate waiting time and improve user experience. Motion can be used in multiple ways to give context and enhance user experience. Accessibility and performance should be considered when implementing animations. Choosing the right library, such as frame of motion or React Spring, can simplify animation implementation. Animations can enhance perceived performance and influence users' perception of speed.

1. Introduction to Interface Animations

Short description:

Hey, I'm Sid, and I do a bunch of things here and there. I've been exploring what makes an interface good to use. Animations can be used to give the user context when used tastefully. Let me show you an example with my social media website called Saturday. The interface currently lacks smoothness, so the first improvement we'll make is fading in the elements.

Hey, I'm Sid, and I do a bunch of things here and there, so I've just put all of it on the screen for you. But what I want to talk to you about is the work I've done at Code Sandbox for the last one, one and a half years. And most of that work involved around the front of the front-end and I was focused on animations, design, gestures, drag and drop, those sort of things.

And I want to kind of ask you this question. What makes an interface good to use? So this is what I've been exploring for the last year now. And there's the common answers which is it should be well-designed. It should be minimal. No clutter on the screen. It should be fast so that when you use the UI, it appears snappy, it loads quickly, there's feedback. But something that gets ignored often is the use of motion or animations to help you out. And animations get chucked into this category where it's for whimsical websites or it's, you know, if you're making a movie or a game website, then you might use it. But I'm here to pitch that animations can be used to give the user context when used tastefully, and you definitely want them in your professional websites as well.

So enough talk. I'm going to show you what I mean. So I built this social media website sort of thing. It's called Saturday, and the logic is that it's only open on Saturdays. And so this is my, this is my feed. I have a few posts from my friends, and let me show you what that looks like. So when I click on a post, it kind of just opens. It just appears. And then there's this reply that appeared. And if I click on the second one, it goes to the feed page. It goes to the post page and you can see the URL changing and it just kind of appears. So that looks a bit odd. Let me go, let me go full screen on this. And then the replies also just, just suddenly appear. So, so that's not really a good, good feel like this is an interface that you're interacting with. It doesn't feel smooth. So the first thing that we'll do is fade these in. And that's, I think that's a pretty common thing across the web.

2. Using Frame and Motion for Fade-In Animations

Short description:

You can use frame and motion for CSS animations in React. By using motion.div, you can define the initial and animate states of an element. This creates a smooth fade-in effect when opening posts and comments, providing a sense of context and change. By implementing this fade-in effect, you can enhance the user experience and improve navigation between different sections of your website.

You see it pretty often. And you can, you can do the, you can of course do any of the examples that I show you with CSS animations. But I'm going to use frame and motion for my examples just because that's what I've been using for a while. And if you're already in React land, then you should definitely check out frame of motion if you haven't.

So the way frame of motion works is that you can take any element and I can say motion.div. And if you use style components or something similar, the API is similar to that. Where you can basically get any element out of motion and use that. I'm just going to use motion.div because that's what it was. And because I'm using a component library here, I'm going to pass it to the as prop and that's just to show that frame of motion can combine well with your component libraries. So it gives me access to these two props. The first one is initial and the second is animate. And I can say what the initial state is and what should it animate to. Of course, there are a bunch of other props, but this is enough to get you started.

So now when I open a post, it fades in instead of just appearing, which gives you this subtle feeling of that something has changed. There's some context here. Even the first post, even though it's just in place, just that tiny flicker which fades in gives you the feeling that you've navigated to a different place. So let's do that with our comments as well. Because right now the comments or replies just kind of pop in, just like appear. They don't really do anything. So I'm gonna change my branch because I've already written the code for it. Let me stash this and go to this branch, fade only. So this is my branch where everything fades in. And you can see when I go from one post to another, the replies fade in subtly. And this is, this is good. This is not great yet. Another place where you can see this is if you have new posts, then they kind of fade in and it gives you a sense of that something has changed even though you've kind of lost your position there. So let's do something about this first. I'm gonna reload. And this is a common pattern that you also see on Twitter and I'm sure they have the reasons for it. When you load more posts or when they choose to load more posts for you, the posts appear in front or they fade in but you kind of lose your position of where you were.

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

A Framework for Managing Technical Debt
TechLead Conference 2023TechLead Conference 2023
35 min
A Framework for Managing Technical Debt
Top Content
Let’s face it: technical debt is inevitable and rewriting your code every 6 months is not an option. Refactoring is a complex topic that doesn't have a one-size-fits-all solution. Frontend applications are particularly sensitive because of frequent requirements and user flows changes. New abstractions, updated patterns and cleaning up those old functions - it all sounds great on paper, but it often fails in practice: todos accumulate, tickets end up rotting in the backlog and legacy code crops up in every corner of your codebase. So a process of continuous refactoring is the only weapon you have against tech debt.In the past three years, I’ve been exploring different strategies and processes for refactoring code. In this talk I will describe the key components of a framework for tackling refactoring and I will share some of the learnings accumulated along the way. Hopefully, this will help you in your quest of improving the code quality of your codebases.

Debugging JS
React Summit 2023React Summit 2023
24 min
Debugging JS
Top Content
As developers, we spend much of our time debugging apps - often code we didn't even write. Sadly, few developers have ever been taught how to approach debugging - it's something most of us learn through painful experience.  The good news is you _can_ learn how to debug effectively, and there's several key techniques and tools you can use for debugging JS and React apps.
The Whimsical Potential of JavaScript Frameworks
React Summit US 2023React Summit US 2023
28 min
The Whimsical Potential of JavaScript Frameworks
Top Content
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.
Building a Voice-Enabled AI Assistant With Javascript
JSNation 2023JSNation 2023
21 min
Building a Voice-Enabled AI Assistant With Javascript
Top Content
In this talk, we'll build our own Jarvis using Web APIs and langchain. There will be live coding.
Power Fixing React Performance Woes
React Advanced Conference 2023React Advanced Conference 2023
22 min
Power Fixing React Performance Woes
Top Content
Next.js and other wrapping React frameworks provide great power in building larger applications. But with great power comes great performance responsibility - and if you don’t pay attention, it’s easy to add multiple seconds of loading penalty on all of your pages. Eek! Let’s walk through a case study of how a few hours of performance debugging improved both load and parse times for the Centered app by several hundred percent each. We’ll learn not just why those performance problems happen, but how to diagnose and fix them. Hooray, performance! ⚡️
Monolith to Micro-Frontends
React Advanced Conference 2022React Advanced Conference 2022
22 min
Monolith to Micro-Frontends
Top Content
Many companies worldwide are considering adopting Micro-Frontends to improve business agility and scale, however, there are many unknowns when it comes to what the migration path looks like in practice. In this talk, I will discuss the steps required to successfully migrate a monolithic React Application into a more modular decoupled frontend architecture.

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.
Building a Shopify App with React & Node
React Summit Remote Edition 2021React Summit Remote Edition 2021
87 min
Building a Shopify App with React & Node
Top Content
WorkshopFree
Jennifer Gray
Hanna Chen
2 authors
Shopify merchants have a diverse set of needs, and developers have a unique opportunity to meet those needs building apps. Building an app can be tough work but Shopify has created a set of tools and resources to help you build out a seamless app experience as quickly as possible. Get hands on experience building an embedded Shopify app using the Shopify App CLI, Polaris and Shopify App Bridge.We’ll show you how to create an app that accesses information from a development store and can run in your local environment.
Build a chat room with Appwrite and React
JSNation 2022JSNation 2022
41 min
Build a chat room with Appwrite and React
WorkshopFree
Wess Cope
Wess Cope
API's/Backends are difficult and we need websockets. You will be using VS Code as your editor, Parcel.js, Chakra-ui, React, React Icons, and Appwrite. By the end of this workshop, you will have the knowledge to build a real-time app using Appwrite and zero API development. Follow along and you'll have an awesome chat app to show off!
Hard GraphQL Problems at Shopify
GraphQL Galaxy 2021GraphQL Galaxy 2021
164 min
Hard GraphQL Problems at Shopify
WorkshopFree
Rebecca Friedman
Jonathan Baker
Alex Ackerman
Théo Ben Hassen
 Greg MacWilliam
5 authors
At Shopify scale, we solve some pretty hard problems. In this workshop, five different speakers will outline some of the challenges we’ve faced, and how we’ve overcome them.

Table of contents:
1 - The infamous "N+1" problem: Jonathan Baker - Let's talk about what it is, why it is a problem, and how Shopify handles it at scale across several GraphQL APIs.
2 - Contextualizing GraphQL APIs: Alex Ackerman - How and why we decided to use directives. I’ll share what directives are, which directives are available out of the box, and how to create custom directives.
3 - Faster GraphQL queries for mobile clients: Theo Ben Hassen - As your mobile app grows, so will your GraphQL queries. In this talk, I will go over diverse strategies to make your queries faster and more effective.
4 - Building tomorrow’s product today: Greg MacWilliam - How Shopify adopts future features in today’s code.
5 - Managing large APIs effectively: Rebecca Friedman - We have thousands of developers at Shopify. Let’s take a look at how we’re ensuring the quality and consistency of our GraphQL APIs with so many contributors.
0 To Auth In An Hour For Your JavaScript App
JSNation 2023JSNation 2023
57 min
0 To Auth In An Hour For Your JavaScript App
WorkshopFree
Asaf Shen
Asaf Shen
Passwordless authentication may seem complex, but it is simple to add it to any app using the right tool.
We will enhance a full-stack JS application (Node.js backend + Vanilla JS frontend) to authenticate users with One Time Passwords (email) and OAuth, including:
- User authentication – Managing user interactions, returning session / refresh JWTs- Session management and validation – Storing the session securely for subsequent client requests, validating / refreshing sessions
At the end of the workshop, we will also touch on another approach to code authentication using frontend Descope Flows (drag-and-drop workflows), while keeping only session validation in the backend. With this, we will also show how easy it is to enable biometrics and other passwordless authentication methods.