Video yükleniyor...

Video Yüklenemedi

Ana Sayfaya Dön

❌ Conditional rendering loses form state in React. ✅ React 19's Activity API preserves it. e.g. Switch between steps → your data stays. Effects cleanup automatically → no wasted resources.

74,295 görüntüleme • 9 ay önce •via X (Twitter)

47 Yorum

Jos Graas 🇱🇺 profil fotoğrafı
Jos Graas 🇱🇺9 ay önce

Ah thats nice. No longer need to wrap values in context or in parent

George Moller profil fotoğrafı
George Moller9 ay önce

@indiegraas Exactly! :100

Jos Graas 🇱🇺 profil fotoğrafı
Jos Graas 🇱🇺9 ay önce

Naming this activity makes absolutely no sense does it 😆

Zeeshan Zubair profil fotoğrafı
Zeeshan Zubair9 ay önce

Exactly, losing form state with conditional rendering is such a pain. Activity API feels like a game-changer for building multi-step forms cleanly.

George Moller profil fotoğrafı
George Moller9 ay önce

Agree! so much easier and cleaner approach.

Adetunji | Software Engineer (Web & Mobile) profil fotoğrafı
Adetunji | Software Engineer (Web & Mobile)9 ay önce

This is really good and onboarding on apps would be much simpler now with this structure

Roxana Muntian profil fotoğrafı
Roxana Muntian9 ay önce

Looks like a powerful feature in React 19. On my current project I use RHF, but no multi-step forms yet. Guess I’ll see how I handle those (no React19 on the project) 😢

George Moller profil fotoğrafı
George Moller9 ay önce

actually RHF doesn't use refs instead of state? this shouldn't be a problem then

Roxana Muntian profil fotoğrafı
Roxana Muntian9 ay önce

RHF uses uncontrolled components under the hood and tracks values via refs. Was curious how to handle the multistep forms. Turns out it’s pretty straightforward - one useForm instance at the top level(keeps data even when steps unmount) - FormProvider to share the form instance using React Context - useFormContext in each form step to read the form instance

George Moller profil fotoğrafı
George Moller9 ay önce

Oh cool! Pretty straight forward then.

Austin K profil fotoğrafı
Austin K9 ay önce

Love the video

George Moller profil fotoğrafı
George Moller9 ay önce

Thanks Austin!

Lou Greenwood profil fotoğrafı
Lou Greenwood9 ay önce

Ever heard of this thing called #EmberJS?

George Moller profil fotoğrafı
George Moller9 ay önce

damn I used to work with Ember JS back in the day!

Lou Greenwood profil fotoğrafı
Lou Greenwood9 ay önce

Come back!

Santi profil fotoğrafı
Santi9 ay önce

nice alternative to using context but not super valuable for more complex forms where you are going to need context anyway imo

Olwiba 🤩 profil fotoğrafı
Olwiba 🤩9 ay önce

This is epic, what software do you use to make these videos?

George Moller profil fotoğrafı
George Moller9 ay önce

hey! I use remotion for these

Florin D profil fotoğrafı
Florin D9 ay önce

Another approch is to use switch case

nyx profil fotoğrafı
nyx9 ay önce

the number of times i've jury-rigged useRef to hold form state between steps just to avoid this exact problem. Activity API feels like an apology letter from the React team

M profil fotoğrafı
M9 ay önce

what version it available and how do you import it?

Alex profil fotoğrafı
Alex9 ay önce

This is a mental illness I swear to god

George Moller profil fotoğrafı
George Moller9 ay önce

Why?

Tobias Madsen profil fotoğrafı
Tobias Madsen9 ay önce

That is why we use context providers, or store keep context

KBYTE TECH👨‍💻 profil fotoğrafı
KBYTE TECH👨‍💻9 ay önce

Wow big improvements

N profil fotoğrafı
N9 ay önce

Looks cool, more memory tho no? Kinda useless if u hoist the state up and use something like zustand.

ᐸAndyParsons/ᐳ profil fotoğrafı
ᐸAndyParsons/ᐳ9 ay önce

I hadn’t considered this, this is very relevant to my interests Thanks man

George Moller profil fotoğrafı
George Moller9 ay önce

Glad you found it useful!

Khadija Ismail goni profil fotoğrafı
Khadija Ismail goni9 ay önce

Activity API is magic for state preservation! Using it in React forms for chem lab inputs (no data loss on switches). Cleanup is clutch for perf in data-heavy UIs. #React19

TradeGenA profil fotoğrafı
TradeGenA9 ay önce

Have you updated your React infographics with the new features? If yes, it would be a great moment for me to update 😅

AI Pilot profil fotoğrafı
AI Pilot9 ay önce

This would be great for an onboarding panel like the one I vibe coded with Claude and Gemini

George Moller profil fotoğrafı
George Moller9 ay önce

exactly, love the design btw!

AI Pilot profil fotoğrafı
AI Pilot9 ay önce

thank you!

Maciek profil fotoğrafı
Maciek9 ay önce

If you use some form library like react-hook-form then this problem shouldn’t occur, but nice idea if you want to use just the build in react features

George Moller profil fotoğrafı
George Moller9 ay önce

because it uses refs right? not state.

Maciek profil fotoğrafı
Maciek9 ay önce

Tbh I don’t know the exact implementation in the react-hook-form code but wrapping this conditional rendering on one level up in the component hierarchy with <FormProvider> is enough since then only its content changes and <FormProvider> doesn’t, which lets you save input value

NullVoxPopuli profil fotoğrafı
NullVoxPopuli9 ay önce

What's activity doing here that CSS dosen't do?

George Moller profil fotoğrafı
George Moller9 ay önce

Clean up

NullVoxPopuli profil fotoğrafı
NullVoxPopuli9 ay önce

What is there to clean up?

Wk - Kevin profil fotoğrafı
Wk - Kevin9 ay önce

@_georgemoller Effects

NullVoxPopuli profil fotoğrafı
NullVoxPopuli9 ay önce

@_georgemoller Why not just not unmount?

Wk - Kevin profil fotoğrafı
Wk - Kevin9 ay önce

@_georgemoller What do you mean? useUnmount() ?

NullVoxPopuli profil fotoğrafı
NullVoxPopuli9 ay önce

@_georgemoller No, i mean, why clean up at all? Just don't unrender the component. Hide it with CSS. If there is a need to go back to the component, why complicate things with more js? (Activity)

Arup profil fotoğrafı
Arup9 ay önce

isnt it adding more complex code structure?

Ahmad Siddique profil fotoğrafı
Ahmad Siddique9 ay önce

That' s great I am really going to use it

Juuno profil fotoğrafı
Juuno9 ay önce

thats pretty cool, didnt know react 19 had that feature

Saq Ib Khan profil fotoğrafı
Saq Ib Khan9 ay önce

Another stupid unnecessary hook/API

Benzer Videolar

Hell froze over: announcing FormKit for React. Secretly framework-agnostic since inception, today we’re open sourcing the most popular Vue form library…for React. Why is this a big deal? 1. Forms are still hard. We (the creators of FormKit) thought form libraries were no longer necessary, given the trajectory of coding agents. It turns out we were wrong, and we learned this the hard way. Need repeating conditional fields nested 3 layers deep inside a dynamic component, with accessibility, validation, internationalization, and backend error placement? Turns out coding agents aren’t great at that. It’s table stakes for FormKit. 2. Single component. This matters more than you would think, but FormKit doesn’t ship lots of different components each with its own props. Instead, it has a single one: and unified props. This was done to provide a better DX to human engineers. It makes it easy to spot when a given component was part of the form’s data structure vs a presentational component. It turns out this matters even more to coding agents than humans. No matter where your coding agent is, whenever it sees “FormKit” it immediately knows “oh, that’s part of the form’s data”. 3. No plumbing. FormKit doesn’t require any manual data collection, event listening, or state tracking. It does all this for you on a heavily tested, framework agnostic, self-assembling graph. The only code your agent needs to write is declarative templates and submission handlers that respond to the state. 4. Dense colocation. FormKit’s syntax happens to be ideal for coding agents; nearly everything you need to know about a given input is *on* the input: Colocation dramatically improves the efficacy of coding agents. 5. DOM. FormKit, unlike most form frameworks in React, renders the actual DOM. This also increases colocation and best practices, meaning your coding agent is far more likely to produce consistent and high-quality output that looks and acts the way its supposed to. 6. Schema. FormKit’s own inputs are not written using Vue or React — instead, FormKit has its own render schema — think of it like an AST for the DOM — and you can modify it on the fly. It’s not very human-friendly to write, but it turns out most models are already pretty well trained on FormKit’s schema. Want your inputs to look a bit different on one form than another? No problem, your coding agent can easily make those changes *without* modifying the JSX structure at all. Oh, and any inputs you create for Vue work with React and vice versa. 7. Plugins. FormKit leans into the unstructured tree graph hard. The graph doesn’t just collect data, it also passes down configuration and plugins. Want one form to work a bit differently than another one? No problem — just add a plugin to the top of that form or group and its children will all receive that feature. You can even mass assign props and configuration this way. Of course, FormKit has been solving these exact issues for a long time, but it wasn’t until we started using it on our own projects with coding agents that we realized what a huge advantage it is. With so many people using coding agents with React, it made sense to unveil FormKit for what it has always been — a completely framework-agnostic form framework that happens to unlock your coding agents. ➡️

Justin Schroeder

11,705 görüntüleme • 6 ay önce

How should you search, filter, and paginate data with Next.js? This demo has 50,000 books in a Postgres database. • Page Load: When the page loads, we see the React Suspense fallback. This loading skeleton is displayed until the first page of books is retrieved from the database. • Searching: The search input has a 200ms debounce. After 200ms of inactivity, the form submits, updating the URL state with `?q={search}`. The Server Component reads `searchParams` and queries the database. On form submission, a React transition starts, allowing us to read the pending status with `useFormStatus` to display an inline loading state. • State Preservation: Navigating to an individual book page retains the search input state. Reloading the page or sharing the link preserves the search results. • Client-side Filtering: Filtering authors in the left sidebar is done client-side. Authors are fetched by a Server Component and passed as props to the sidebar. Changing the input value updates React state and re-renders the sidebar. • Optimistic Updates: The sidebar’s selected authors are optimistically updated with `useOptimistic`. Checkbox selections update instantly without waiting for the URL to change. • State Preservation: Navigating to an individual book page retains the sidebar filter input and selected author state across navigations, giving it an app-like feel. • Pagination: Navigating between pages updates the URL state, triggering the Server Component to query the database for the specific page of books. We also fetch the total book count to show the total number of pages. This demo isn't perfect yet (still working on it) but it's been a fun playground for some of these patterns. You can imagine a similar experience for thousands of movies, cars, products, or any other very large dataset. Demo → Code →

Lee Robinson

237,013 görüntüleme • 2 yıl önce

Your agents can't keep up with real-time data. Especially when it's scattered across dozens of sources. Most teams waste weeks building custom connectors for every database, API, and data warehouse. Then they build ETL pipelines to sync everything. By the time your agent retrieves the data, it's already outdated. Picture this: Your Postgres database updated 5 minutes ago. Your MongoDB collection changed 2 minutes ago. Your agent is still pulling from yesterday's snapshot. This is why most production RAG systems fail. There's a better approach: MindsDB is an open-source AI platform with a federated data engine that lets you query multiple data sources in real-time using SQL - without moving any data. Here's what makes it different: ↳ Your data stays in place. No ETL pipelines or data duplication ↳ Query Postgres, MongoDB, REST APIs, and more using consistent SQL ↳ JOIN across different sources in real-time with a unified interface ↳ Works with both structured and un-structured data And here's the best part: You don't even need to write SQL. Just describe what you want in plain English, and MindsDB converts it to SQL automatically. The system does all the heavy lifting. The breakthrough for AI agents is simple: When data updates at the source, your agent gets fresh results immediately. No sync delays. No stale embeddings. No custom code for each integration. You can literally write a SQL query that joins a Postgres table with a MongoDB collection and gets live results. This is what production AI applications need but rarely get. In this video, I give you a complete walkthrough of what we just discussed and how to actually do it. Make sure you watch this till the end. I've shared the link to MindsDB's GitHub repo in the next tweet!

Akshay 🚀

65,672 görüntüleme • 11 ay önce

GeoLibre v1.2.0 is here! GeoLibre is a free and open-source, lightweight, cloud-native GIS platform for visualizing, exploring, and analyzing geospatial data. One application that runs everywhere: in your web browser, as a native desktop app, on your phone, and inside a Jupyter notebook. No account, no server, no cost. Everything runs locally and your data stays private. This release packs in 35+ pull requests of new capabilities. A few highlights: - Run SQL right in the browser. The SQL Workspace pairs DuckDB Spatial with a new in-browser PostGIS engine (PGlite), so you can query layers, local files, and remote URLs without a server. - A smarter attribute table. Add fields, run a field calculator, and explore your data with a built-in Charts panel (histogram, scatter, bar, line, and box plots). - More ways to add data. OpenStreetMap PBF extracts, Cloud-Optimized NetCDF/HDF via kerchunk, georeferenced video overlays, authenticated 3D Tiles, and a Layer builder for custom overlays. - Better visualization. Heatmap rendering, point clustering, and H3 hexagonal grids for spatial binning. - New analysis and routing. A Directions plugin, plus Spatial Join, Select by Value, and Select by Location vector tools. - Print and share. A print layout composer that exports your map to PNG or PDF. - Work faster. A command palette (Ctrl/Cmd + K), global keyboard shortcuts, and undo/redo for layer and style operations. - Built for everyone. New internationalization framework, an accessibility pass with automated axe checks, an installable offline-capable PWA web build, React error boundaries, and Playwright end-to-end tests. Try the live demo: Star it on GitHub: Docs and roadmap: Release notes: #GIS #OpenSource #Geospatial #MapLibre #WebGIS #DuckDB #GeoLibre

Qiusheng Wu

40,407 görüntüleme • 4 ay önce

Hollywood has a dirty secret. That perfectly clean green screen shot in your favorite Marvel movie? A human being sat in a dark room for 6 hours fixing it frame by frame. The AI keyer got the body. A person painted every strand of hair. By hand. At 2 AM. For 400 frames. The software costs $5,000 a year. And it still cannot key hair. Nuke: $4,988/year. Cannot key hair in motion blur. After Effects: $264/year. Cannot key transparent glass. Boris FX: $1,865. Cannot key fine edges without haloing. The industry's solution for 30 years has been the same: pay for expensive software, then pay a human to fix what the software couldn't. The YouTubers behind Corridor Crew looked at this and asked a different question. What if the AI didn't try to remove the green? What if it figured out what color was actually there before the green contaminated it? They trained a neural network on synthetic 3D data. Not scraped footage. Not stolen clips. Perfectly rendered scenes where every pixel's true color was already known. Hair strands. Motion blur. Transparent glass. All simulated with known ground truth. Then they fed it real green screen footage. It worked. They called it CorridorKey. Then they open sourced it. → Feed it raw green screen footage → AI reconstructs the true foreground color for every pixel → Hair stays perfect. Every strand. → Motion blur stays intact. Every frame. → Transparent glass stays transparent. → 16-bit and 32-bit EXR output. Nuke-ready. Resolve-ready. → Handles 4K natively → Runs on consumer GPUs. 6 GB VRAM minimum. → Runs on Apple Silicon via MLX → Auto-detects green or blue screen → Removes tracking markers automatically → DaVinci Resolve plugin live → Standalone GUI for non-technical users → One-click installer. No Python setup. Here's the wildest part: Within 2.5 months: 13,000+ GitHub stars. 787 forks. Active Discord. Community built a cloud render farm so you can process footage without owning a GPU. DaVinci Resolve plugin shipped. Nuke and After Effects plugins in development. VFX freelancers are already offering CorridorKey-powered services to production companies. One person. One GPU. Hollywood-quality keys. A business built on free software. Nuke: $4,988/year. Still needs manual cleanup. After Effects: $264/year. Still needs manual cleanup. Rotoscope artist: $50 to $150/hour. For the cleanup. CorridorKey: $0. No cleanup needed. One honest flag: the license is CC BY-NC-SA 4.0. Free forever for personal projects, students, indie films, and learning. Commercial use requires permission from Corridor Digital. They did not pretend it was MIT. A problem that plagued Hollywood for 30 years. Solved by YouTubers. Open sourced for free. 13,000+ stars. 787 forks. CC BY-NC-SA 4.0. Your footage. Your keys. No rotoscoping.

Nav Toor

296,335 görüntüleme • 5 ay önce