Frontend First cover image

Frontend First

Latest episodes

undefined
Dec 12, 2024 • 49min

Creating a background gradient from an image

Ryan talks to Sam about reproducing iOS's new image background treatment for his Open Graph Preview tool, opengraph.ing. They talk about different approaches for generating gradients from images, including finding the vibrant color of an image, luminosity-weighted averages, k-means clustering, and more.Timestamps:0:00 - Intro3:07 - Apple's new OG image gradient10:06 - Luminosity-weighted average14:22 - Finding the vibrant color of an image21:41 - Contrast ratios on favicons32:21 - K-means clustering41:25 - Refactoring UI tip about rotating the hueLinks:Open Graph PreviewRefactoring UI
undefined
Nov 14, 2024 • 60min

Exploring useActionState

Sam and Ryan talk about React 19's useActionState hook. They discuss how adding async functions to a plain React app introduces lots of in-between states that developers must grapple with, and how useActionState allows React to collapse and eliminate these states, bringing the simplicity of React's sync mental model to our async code.Timestamps:0:00 - Intro1:51 - How React normally eliminates state in synchronous apps8:20 - How useActionState lets React eliminate state in asynchronous apps18:17 - Why you shouldn't just pass server actions into useActionState23:00 - TCP/IP and UDP analogy26:39 - Thinking of useActionState like enqueue34:55 - Why the term "reducer" is too loaded for best understanding useActionState51:07 - How useActionState helps you build a Todo app that stays responsive during pending actions
undefined
Oct 31, 2024 • 43min

Cloudflare Tunnel | React Compiler | refs during render

Sam and Ryan talk about using Cloudflare Tunnel for local development, the new React Compiler beta release, and why reading or writing refs during render violates the rules of React.Timestamps:0:00 - Intro1:42 - Cloudflare Tunnel7:06 - React Compiler14:21 - Reading or writing refs during renderLinks:Cloudflare TunnelReact Compiler Beta releaseReact Docs Pitfall on refs
undefined
Oct 24, 2024 • 1h 8min

useAnimatedText | Events vs. State Changes | Catalyst

Sam and Ryan talk about building a useAnimatedText hook that can animate streaming text. They also discuss how React code that uses state changes to approximate events can be simplified, and the benefits of having escape hatches when building UI with Catalyst.Timestamps:0:00 - Intro1:22 - Catalyst and escape hatches16:03 - Building a useAnimatedText hook (aka useBufferedText)54:10 - Avoiding using state changes to approximate eventsLinks:CatalystSam's Tweet about useBufferedText and AnimatedScrolleruseAnimatedText recipeIntl.Segmenter on MDNDavid K's Tweet on eventsRicky's Tweet on Intersection ObserverBuild UI's new course
undefined
Oct 10, 2024 • 58min

Can you self-host Next.js?

Sam and Ryan talk about how frameworks and infrastructure evolve with each other, using Next.js as a representative example. They discuss how hosting providers like Heroku have always imposed certain constraints on apps, what features those constraints enable hosting providers to support, how burdensome those constraints are across different frameworks, and how frameworks that add infra-specific APIs can best communicate the costs of those APIs and benefits they enable.Timestamps:0:00 - Intro3:03 - Heroku and the Twelve-Factor App7:39 - GitHub Pages and static sites13:57 - Serverless and JAMstack17:30 - Vercel and CDNs, self-hosting, and Next.js19:00 - How framework APIs can nudge an app towards a particular hosting solution23:09 - What constraints does Next.js impose on your app (e.g. middleware doesn't run node), and what benefits do those constraints give you?36:13 - How Next.js APIs are motivated by wanting to tease apart static and dynamic code, in an attempt to support the needs of any web app with a single stack40:33 - What is the relationship between frameworks and infra?47:37 - How can frameworks that add infra-specific APIs best communicate the costs of those APIs and the benefits they enable?Links:The Twelve-Factor App
undefined
Sep 18, 2024 • 1h

Tom Occhino on the future of React

Tom Occhino, Chief Product Officer at Vercel and former Engineering Director at Facebook, joins Sam to talk about the pivotal moments in React's history. He talks about how React popularized the ideas of declarative rendering and unidirectional data flow, how GraphQL furthered React's goal of co-locating all the concerns of a particular piece of UI, the problems that GraphQL led to at Facebook and how Relay solved them, and how Suspense, Server Components, and PPR are the generalized spiritual successors to the stack used at Facebook.Timestamps:0:00 - Intro2:53 - Declarative rendering as React's legacy8:12 - How GraphQL enabled complex components to be fully self-contained20:12 - How React's goal has always been to co-locate all the concerns of a particular piece of UI22:58 - The problem with co-locating GraphQL with components, and how Relay solved it26:28 - How RSC is the generalized spiritual successor to BigPipe and GraphQL34:46 - What PPR is, and how it and Suspense fit into this story55:55 - The general paradigm shift of getting static code to the device as soon as possibleLinks:Tom Occhino with Ben DunphyReact: The DocumentaryReact Roundtable with Andrew Clark and Sebastian MarkbågeTom Occhino on Twitter
undefined
Sep 5, 2024 • 35min

Render props

Dive into the intriguing world of render props in React! Discover their origins and how hooks have taken the spotlight for sharing stateful logic. Learn how render props still shine in managing complex components like forms. The discussion also uncovers the comparison between data attributes and render props for custom styling. Unravel the art of peeking into an uncontrolled component's internal state and explore effective component patterns for enhanced customization. It's a treasure trove of insights for any frontend enthusiast!
undefined
Aug 28, 2024 • 47min

Controlled and uncontrolled components

Sam and Ryan discuss controlled and uncontrolled components in React. They talk about how uncontrolled components can be thought of as components that manage their own internal state, why you should model your complex React components after the simpler APIs of native HTML elements like inputs, why you shouldn't try to make components that are both controlled and uncontrolled, and why making a new component boundary is sometimes all you need to make your custom components behave more predictably.Timestamps:0:00 - Intro1:41 - What are controlled and uncontrolled components?6:11 - How to change a component from uncontrolled to controlled8:48 - How do you decide when to use a controlled or uncontrolled component?12:00 - Sortable table example and a single source of truth15:27 - Is it always either controlled or uncontrolled?21:09 - Color picker example and not exposing internal state28:46 - Sortable list example with Framer Motion39:45 - Component boundaries and wearing two hats: the library author vs. library consumer41:43 - How do you know if you are using the wrong approach?Links:New course: Advanced React Component PatternsReact docs: Controlled and uncontrolled componentsReact docs: Storing state from previous rendersEmail SamEmail RyanFrontend First on Twitter
undefined
Aug 15, 2024 • 34min

Unstyled React components

Sam, a React expert, and Ryan, a UI library enthusiast, dive into the transformative concept of unstyled components. They explain how these components allow designers and developers to share logic without enforcing specific styles. The discussion highlights the advantages over traditional UI libraries like Bootstrap and delves into the art of composition in building robust interfaces. They also cover how to integrate unstyled components with styled ones and the significance of choosing the right patterns to enhance code reusability.
undefined
Aug 1, 2024 • 1h 3min

What is a framework?

Sam and Ryan dive deep into the essential qualities of web frameworks. They discuss the delicate balance between flexibility and cohesion in development. The importance of integrating diverse systems is emphasized, along with the harmony frameworks should maintain with their programming languages. The conversation also touches on the evolving landscape of JavaScript frameworks and the innovative future of React Server Components. Lastly, they highlight how taste and effective API design play crucial roles in enhancing the user experience.

Get the Snipd
podcast app

Unlock the knowledge in podcasts with the podcast player of the future.
App store bannerPlay store banner

AI-powered
podcast player

Listen to all your favourite podcasts with AI-powered features

Discover
highlights

Listen to the best highlights from the podcasts you love and dive into the full episode

Save any
moment

Hear something you like? Tap your headphones to save it with AI-generated key takeaways

Share
& Export

Send highlights to Twitter, WhatsApp or export them to Notion, Readwise & more

AI-powered
podcast player

Listen to all your favourite podcasts with AI-powered features

Discover
highlights

Listen to the best highlights from the podcasts you love and dive into the full episode