Are You In A React Cult?
13:27
2 ай бұрын
Are Your React Components Too BIG?
12:20
How To Debug Broken APIs
15:02
6 ай бұрын
Пікірлер
@fadfooood
@fadfooood 17 сағат бұрын
Amazing video as usual ❤️
@asdqwe4427
@asdqwe4427 19 сағат бұрын
Getting seriously fatigued by new react features
@thisweekinreact
@thisweekinreact 19 сағат бұрын
Great video! 2 extra notes: - React 19 automatically reset forms on actions, or you can call new ReactDOM.requestFormReset() API when using onKeyUp - React transitions need to be async due to lack of support of AsyncContext in browsers. setState calls after the await won't be part of the transition, you need to nest an extra startTransition call to make them part of the current transition Will send a Twitter DM, easier to explain :D
@arvind6151
@arvind6151 22 сағат бұрын
Keep going Jack, really useful to see RC updates like this. 👍
@Luisllaboj19
@Luisllaboj19 22 сағат бұрын
They extrended "useTransition" hook to accept async functions now :D
@Luisllaboj19
@Luisllaboj19 22 сағат бұрын
Also the form inputs areautomatically cleaned up when the task resolves
@marroos5440
@marroos5440 23 сағат бұрын
Hello, i am still learning and i've checked useActionState from latest version of NextJs and it looks like improved useFormState to me, so i would like to use it for pending/error states when i use server action (let's say addTodo). Why should i use useOptimistic hook too? I mean when i press Button in form with server action in useActionState i can add loading/ spinner status while isPending is active and/or error text once error occurs. If everything goes well, new todo is added to list and displayed. I am getting confused with all those new hooks and changes, so i would like to know what is the point of useOptimistic in scenario i've described. Does useOptimistic work like placeholder for data showing: once it is successful, data stays, and if not, they disappear? Ty :-)
@jherr
@jherr 18 сағат бұрын
Yes, that's the way useOptimistic works as shown in the video. It looks like useOptimistic is a best match for smaller operations; A like/subscribe button, for example.
@coinvest0
@coinvest0 23 сағат бұрын
Very detailed explanation, thank you very much!
@xxXAsuraXxx
@xxXAsuraXxx 23 сағат бұрын
Waiting for useNextJsDepression()
@ballingt
@ballingt Күн бұрын
Fantastic presentation and content as usual, love these.
@ballingt
@ballingt Күн бұрын
re 11:34 addNewTodo() will run synchronously up to the first await, so I believe that's why setOptimisticTodos works
@usmansbk
@usmansbk Күн бұрын
Apollo client
@ErikBongers
@ErikBongers Күн бұрын
The issue is that in JavaScript you can't distinguish between a const pointer and a const value. In JS, it's always just the pointer that is const, never the value.
@jherr
@jherr 18 сағат бұрын
True. But some assurance is better than none.
@pedromenezes7175
@pedromenezes7175 Күн бұрын
As always, pretty insightful video with clear explanations and examples! Thanks for covering as much as possible in such a concise video!
@rayevo8mr209
@rayevo8mr209 Күн бұрын
Is there a way to optimistically perform more than one CRUD action? I ran into this problem where i had managed state but need to add / remove etc optimistically but the logic was honestly getting out of control compared to using something like use swr or zustand for state management.
@jherr
@jherr 18 сағат бұрын
Sure, in this model you can do as much work in the action as you want, and set as many optimistic values as you want. The nice thing is that you get the automatic rollback when things fail.
@nazarocean
@nazarocean Күн бұрын
Thanks for the useful video!
@yashsolanki069
@yashsolanki069 Күн бұрын
When will the pronextjs course be available??
@jherr
@jherr 18 сағат бұрын
It's in final priduction right now. So it's actually out of my hands.
@yashsolanki069
@yashsolanki069 18 сағат бұрын
@@jherr awesome!! Looking forward to it. I hope pricing is considered with PPP. Otherwise i would have to rob a bank here in india to get this purchase done.😂
@gerkim3046
@gerkim3046 Күн бұрын
wtf is the difference between addTodo() vs addNewTodo()?
@hikarukun5126
@hikarukun5126 Күн бұрын
Tired of React
@rayyanalam4815
@rayyanalam4815 Күн бұрын
Can anyone let me know the theme?
@derSeega
@derSeega Күн бұрын
Okay, I'm not a big fan of this I think. I'm not feeling like this is enhancing the readability of the code to be honest. Updating the state manually and afterwards overriding it with the response is not adding more code than the useOptimistic, but everyone will understand what is happening. And I was hopeing we can have less hooks in react 19 not more 😒😒 Maybe some one can convince me
@reichenwald-gm4qd
@reichenwald-gm4qd Күн бұрын
I would be cool to show the all the extensions like console ninja you’re using
@denilsoncosta9837
@denilsoncosta9837 Күн бұрын
i used it in a app where has the car functionality and the UX become better when the user increment or decrement the quantity of a product.
@seyhaphan7319
@seyhaphan7319 Күн бұрын
I have problem when I want to display data with dynamic 50+ rows it so slow. Did you know what is problem ?
@jherr
@jherr Күн бұрын
You'd have to supply a lot more information than this to get help on your issue. Feel free to post your question on the Blue Collar Coder Discord server, but please READ and FOLLOW the #rules before posting.
@flippo_
@flippo_ Күн бұрын
Great vid as always! Correct me if I'm wrong but I believe with form action the input field should clear it self so you don't need that ref.current.value = ""? Tried to recreating it and it worked on my end at least, also I think the reason why the app "blew up" after you introduced useActionState was because the current action payload is the second argument not the first
@keepforever726
@keepforever726 Күн бұрын
Ew, what a mess these APIs are. Remix does all of this so much cleaner.
@jherr
@jherr Күн бұрын
I looked it up and Remix's "support" for optimistic UI is just a coding pattern you can lift (www.learnremix.io/learn-remix/optimistic-ui-with-remix#handling-errors-with-remix-and-optimistic-ui) that is kind-of supported by the Form. But there example at the end has a very jank likeCount - 1 setting of the useState if it fails... I don't see how that's better. Also, Remix (or React-Router) is built on top of React, so you'll get this hook either way with React-Router 7. Which will also give you server actions.
@abodiit
@abodiit Күн бұрын
Great video thanks Jack, one question though how you are doing the syntax highlights when you are explaining and rest of the code fade
@jherr
@jherr Күн бұрын
I do that manually in Screenflow as I'm assembling the video.
@mzimmma
@mzimmma Күн бұрын
PLEASE STOP USING STUPID BOOMERS TODO STUPID EXAMPLE.
@mzimmma
@mzimmma Күн бұрын
remember when optimistic functions used to be anti-user friendly. Now it's the time to be optimistic lier in your frontend till your backend requests return if they don't fail.
@PhilipAlexanderHassialis
@PhilipAlexanderHassialis Күн бұрын
Excellent video Jack as usual! What's your opinion on all the code tied with the useOptimistic/startTransition/useActionState/etc that we have to write just to get an optimistic update? Doesn't it seem a bit boilerplate-y?
@derSeega
@derSeega Күн бұрын
Thanks, I'm also not convinced this is enhancing the readability. Just more hooks to hide the obvious.
@matteo_gabriele
@matteo_gabriele Күн бұрын
Gotta love that Ttttsszzzustand pronunciation!
@ps14dd88
@ps14dd88 Күн бұрын
Looks like a little bit complicated/over engineered to implement a simple optimistic UI in a todo app
@PhilipAlexanderHassialis
@PhilipAlexanderHassialis Күн бұрын
My thoughts exactly. It's not that it doesn't work per se, but try to imagine this for a complicated form state and not a single value. Imagine a form with multiple fields, and even worse, imagine a form where some fields depend on other fields and the "detail" fields need to fetch new values depending on the "master" fields. A chaos all in all.
@porroapp
@porroapp Күн бұрын
Thats why we use RQ in production. Code is simpler and more maintainable.
@rayevo8mr209
@rayevo8mr209 Күн бұрын
It is mate, all the demos always show a simple scenario but in real web apps it's absolute chaos with this hook
@camilo5821
@camilo5821 Күн бұрын
cheers from Chile Jack!!
@sufiblade
@sufiblade Күн бұрын
They're not very optimistic if we'll use this implementation
@Caldaron
@Caldaron Күн бұрын
using that suspense properly handler reminds me of the bad old redux days. does react actually hire for overengineering?
@mpbros.official
@mpbros.official 2 күн бұрын
You are the best!!!
@patrickjreid
@patrickjreid 2 күн бұрын
Jack, i love your videos! I would love it if you did a review on tinybase. It seems like a very useful state manager specializing in offline first.
@lukei9772
@lukei9772 2 күн бұрын
just to be clear, just putting a sqlite.db file in your project wont work in production if you deploy to vercel right?
@jherr
@jherr 2 күн бұрын
Correct. Turso is a sqlite compatible remote database. So you can just change out the file URL for a Turso URL.
@fadfooood
@fadfooood 2 күн бұрын
I noticed the compiler is not memoizing functions from custom hooks. I had to useCallback my functions in my custom hooks to avoid rerenders. Any idea why?
@jherr
@jherr 2 күн бұрын
Is it not optimizing any custom hooks? Or just that one custom hook? If it's just that one then it's possible that the compiler assessed some issue with it that wouldn't allow for optimization. The compiler is very conservative. If it doesn't think it can safely optimize the code without a change in behavior it will just leave the component or hook as is.
@fadfooood
@fadfooood 2 күн бұрын
@@jherr Thank you for your reply. Yes I noticed it is not optimising any functions destructed from custom hooks. I thought the compiler will do so but when I brought back useCallback to memoize functions in custom hooks then components using these functions stopped re-rendering.
@dopetag
@dopetag 2 күн бұрын
That was heavy. Does memoization not create new map each time?
@jherr
@jherr 2 күн бұрын
No, the memoization function is a closure creator. It gets invoked once. Creates a local map. Then returns a function, which is the one we use, which uses that map to store promises.
@dopetag
@dopetag 2 күн бұрын
@@jherr oh, yes! Thanks for response. I see it now.
@spidfair0
@spidfair0 3 күн бұрын
I like that caching becomes more of an opt-in feature. What I'd like to know is if request memoization is also affected by this change. Deduping fetch calls of a single request was great as it reduced prop-drilling. If caching is off by default, does that also mean that deduping on a single request is also off?
@jherr
@jherr 3 күн бұрын
fetch de-duping during the request is a core feature of React 19, so it's still there. There is some talk that they will stop patching fetch in the future, so we might end up needing to import a specific fetch to get the de-duped behavior.
@IvanKleshnin
@IvanKleshnin 4 күн бұрын
He's right yet he selected a bad argument. It's not about mutability, it's about Bang for the Buck. The reasoning of an average Js.Joe is very "cheap", if soon there appears a feature that helps them to spot a code issue once in 10 years, in return requiring to postfix_ boolean variables with underscore... most JS coders would enthusiastically accept it, bragging about supposedly improved 'code quality'. They don't care about readability, they are extremely easy to buy into something stupid - like no other programming community. The same happened with == vs === when some vicious Java dude, for a joke, taught every frontender to mindlessly use ===, like `typeof s === "string"` where typeof always return a string. But millions of JS monkes keep stroking this extra character... because it's a ritual. The same happened with TS 'readonly' which adds tons of troubles for no gains. Respect to Ryan for standing against the crowd, albeit I'm not his follower, he's right in his attitude to frontenders en masse. const does not add anything useful, except a feeling of a false self-satisfaction. How often do you reassign variables in practice so const vs let becomes such an important distinction for a new keyword? So many self-proclaimed FP fanboys among JS coders, they have to use conditional expressions, don't they? Why not a dedicated keyword for floats vs ints? Not a keyword for natural numbers? They would, at least, be useful.
@user-wz4mi3fd4b
@user-wz4mi3fd4b 4 күн бұрын
I wonder how you would handle the selector if its an array of objects? Been wracking my head around how to handle that one. All the objects have a unique key so they could then be a selector for [idkey] : { // other objects }? Starting to realize how important data design is at a company where it was created organically so its a bit of a mess
@jherr
@jherr 4 күн бұрын
References are the way to handle change detection in React. That's how the entire system is built. If any element in the array changes then the array reference itself should change. And then you can detect changes to the complete array easily using Object.is with the current value and the previous value.
@MartinEide-sq8og
@MartinEide-sq8og 4 күн бұрын
Love htmx and astro. Alpine js was just that last missing reactivity part I was looking for. ❤
@kkjoe2677
@kkjoe2677 4 күн бұрын
For time1 and time2, can we put them in separate suspense and put all suspense under a suspenseList to ensure the waterfall and sequential rendering? If so, what makes the difference here?
@jherr
@jherr 4 күн бұрын
Give it a go. Putting them in their own suspenses will bring back the parallel behavior since the blocking is only the the context of a single suspense. I don't know if SuspenseList changes that behavior, but my hunch is not. FWIW, I haven't used SuspenseList. Also, given that Joe Savona has now also come out and said there will be a "good fix" I think we will get the old behavior back. Will it be the default? Who knows. But we should at least have some way to get the original behavior.
@AndreasSchlapbach
@AndreasSchlapbach 4 күн бұрын
Didn't like that some of the styling (like padding or margins) is in the components and some is in CSS. Preferring tailwind's unified tailwind approach.
@chorymiguel
@chorymiguel 4 күн бұрын
'prefer-const': 'off'
@ykl0919
@ykl0919 4 күн бұрын
Thank you for posting this video. It is such a treasure for people like me who mostly self-learned
@saramshshrestha7641
@saramshshrestha7641 4 күн бұрын
I just really love you. You might be one the best teacher out their.
@jherr
@jherr 4 күн бұрын
Thank you!
@KayandraJT
@KayandraJT 4 күн бұрын
Just like server components, the approach to hoisting promises makes sense to me. It's how I've been doing it for years. Data should be separated from rendering, this is how you avoid buggy applications.
@ngocquach9961
@ngocquach9961 5 күн бұрын
could you explain more about typescript apply for micro?
@jherr
@jherr 4 күн бұрын
There is a plugin now for TypeScript with federated modules. I haven't looked into how it works. But the approach that I've heard in the past is that when the federated module is created a sibling .d.ts file is created, zipped and deployed alongside the JS file for the module. Then when the hosting application is built the plugin pulls down the zipped .d.ts file before TSC compilation, and... viola. Types.