Загрузка видео...

Не удалось загрузить видео

На главную

❌ 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 просмотров • 9 месяцев назад •via X (Twitter)

Комментарии: 47

Фото профиля Jos Graas 🇱🇺
Jos Graas 🇱🇺9 месяцев назад

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

Фото профиля George Moller
George Moller9 месяцев назад

@indiegraas Exactly! :100

Фото профиля Jos Graas 🇱🇺
Jos Graas 🇱🇺9 месяцев назад

Naming this activity makes absolutely no sense does it 😆

Фото профиля Zeeshan Zubair
Zeeshan Zubair9 месяцев назад

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
George Moller9 месяцев назад

Agree! so much easier and cleaner approach.

Фото профиля Adetunji | Software Engineer (Web & Mobile)
Adetunji | Software Engineer (Web & Mobile)9 месяцев назад

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

Фото профиля Roxana Muntian
Roxana Muntian9 месяцев назад

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
George Moller9 месяцев назад

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

Фото профиля Roxana Muntian
Roxana Muntian9 месяцев назад

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
George Moller9 месяцев назад

Oh cool! Pretty straight forward then.

Фото профиля Austin K
Austin K9 месяцев назад

Love the video

Фото профиля George Moller
George Moller9 месяцев назад

Thanks Austin!

Фото профиля Lou Greenwood
Lou Greenwood9 месяцев назад

Ever heard of this thing called #EmberJS?

Фото профиля George Moller
George Moller9 месяцев назад

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

Фото профиля Lou Greenwood
Lou Greenwood9 месяцев назад

Come back!

Фото профиля Santi
Santi9 месяцев назад

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

Фото профиля Olwiba 🤩
Olwiba 🤩9 месяцев назад

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

Фото профиля George Moller
George Moller9 месяцев назад

hey! I use remotion for these

Фото профиля Florin D
Florin D9 месяцев назад

Another approch is to use switch case

Фото профиля nyx
nyx9 месяцев назад

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
M9 месяцев назад

what version it available and how do you import it?

Фото профиля Alex
Alex9 месяцев назад

This is a mental illness I swear to god

Фото профиля George Moller
George Moller9 месяцев назад

Why?

Фото профиля Tobias Madsen
Tobias Madsen9 месяцев назад

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

Фото профиля KBYTE TECH👨‍💻
KBYTE TECH👨‍💻9 месяцев назад

Wow big improvements

Фото профиля N
N9 месяцев назад

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

Фото профиля ᐸAndyParsons/ᐳ
ᐸAndyParsons/ᐳ9 месяцев назад

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

Фото профиля George Moller
George Moller9 месяцев назад

Glad you found it useful!

Фото профиля Khadija Ismail goni
Khadija Ismail goni9 месяцев назад

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
TradeGenA9 месяцев назад

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

Фото профиля AI Pilot
AI Pilot9 месяцев назад

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

Фото профиля George Moller
George Moller9 месяцев назад

exactly, love the design btw!

Фото профиля AI Pilot
AI Pilot9 месяцев назад

thank you!

Фото профиля Maciek
Maciek9 месяцев назад

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
George Moller9 месяцев назад

because it uses refs right? not state.

Фото профиля Maciek
Maciek9 месяцев назад

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
NullVoxPopuli9 месяцев назад

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

Фото профиля George Moller
George Moller9 месяцев назад

Clean up

Фото профиля NullVoxPopuli
NullVoxPopuli9 месяцев назад

What is there to clean up?

Фото профиля Wk - Kevin
Wk - Kevin9 месяцев назад

@_georgemoller Effects

Фото профиля NullVoxPopuli
NullVoxPopuli9 месяцев назад

@_georgemoller Why not just not unmount?

Фото профиля Wk - Kevin
Wk - Kevin9 месяцев назад

@_georgemoller What do you mean? useUnmount() ?

Фото профиля NullVoxPopuli
NullVoxPopuli9 месяцев назад

@_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
Arup9 месяцев назад

isnt it adding more complex code structure?

Фото профиля Ahmad Siddique
Ahmad Siddique9 месяцев назад

That' s great I am really going to use it

Фото профиля Juuno
Juuno9 месяцев назад

thats pretty cool, didnt know react 19 had that feature

Фото профиля Saq Ib Khan
Saq Ib Khan9 месяцев назад

Another stupid unnecessary hook/API

Похожие видео

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 просмотров • 6 месяцев назад

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 просмотров • 2 лет назад

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 просмотров • 11 месяцев назад

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 просмотров • 4 месяцев назад

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 просмотров • 5 месяцев назад