Тёмный
Lachlan Miller
Lachlan Miller
Lachlan Miller
Подписаться
I make content about Vue.js, JavaScript and testing. I try to upload or release a new video every day.
How To Debug Infuriating Module Errors
7:32
7 месяцев назад
My Favorite TypeScript Tips and Tricks
10:21
8 месяцев назад
3 Ways to Avoid Prop Drilling in Vue/React
9:34
8 месяцев назад
Form Validation Strategies for JavaScript Apps
10:09
8 месяцев назад
Patterns for Error Handling
9:47
10 месяцев назад
Pushing Logic into Composables
11:32
Год назад
Cypress CT 7/8 - A Suspenseful Test
8:13
2 года назад
Комментарии
@gkiokan
@gkiokan 7 часов назад
I did bundle with grunt at the very beginning where nothing else existed, then webpack and I stay at webpack until it breaks something specially. Never change a good running system. So Vite does sound good, but I would never refactor my bundle process on a existing process. So I will wait wait wait and wait until it's mature enough. For new Projects, it's worth maybe the try. Just my 2 cents.
@marcialabrahantes3369
@marcialabrahantes3369 4 дня назад
webpack was built FOR react. aside from that, great content we've been building on complicated frontends for a while before webpack
@coder_one
@coder_one 5 дней назад
Non-mutable state is one of the advantages of React. Fortunately, you can write a simple composable "useState" that will provide a reactive value and a function to change it in Vue. Why is that? Because good patterns are worth using regardless of the frameworks you work in
@LachlanMiller
@LachlanMiller 5 дней назад
Why is mutable state bad? I think it's fine - as long as you manage it well, try to keep the mutation limited, and understand your system and how the data flows through it: bar.value = "foo" setBar("foo") Are these really that different? Seeing a function call without assignment (in the `setBar` example) means there **is** a side effect (mutation) somewhere, right?
@coder_one
@coder_one 5 дней назад
@@LachlanMiller There have been a whole bunch of books, articles, videos and projects proving why direct state mutation is the cause of many bugs, including ones that are difficult to debug. Comments under the youtube video does not lend itself to a thorough discussion of this issue, I recommend You a little work with a search bar and you will easily find a comprehensive materials about the the drawbacks of directly mutable state.
@LachlanMiller
@LachlanMiller 4 дня назад
@@coder_one Yep definitely a ton of content out there. I am not convinced `setState(foo)` is any better than `foo.value = "bar'"` - it's more about how and where you handle the mutation than anything else, imo. Ideally - push the mutation to the edges of your system, and understand how the data flows; keep your business logic immutable and pure, and only mutate things in response to external effects (API call, user interaction...). Fascinating topic! My favorite video on this is "Functional Core, Imperative Shell" from "Destroy all Software". Check it out and lmk what you think!
@Puji-cr7ps
@Puji-cr7ps 6 дней назад
what is opt in actually?
@sinaniksaba6741
@sinaniksaba6741 6 дней назад
0:51 is the best part of the video
@YoussefAdelWahba
@YoussefAdelWahba 14 дней назад
I always love to know what is happening under the hood in the tools and frameworks I use otherwise I feel uncomfortable while using them and this explanation helped me to scratch the surface and figure out what is going on and what are these tools is all about, thank you a lot.
@YoussefAdelWahba
@YoussefAdelWahba 14 дней назад
thank you, this is extremely helpful and clear.
@senayb3
@senayb3 17 дней назад
Great run through!! Helps wrap my head around things.
@SSn0wx
@SSn0wx 23 дня назад
Pretty cool video :)
@daremondlars
@daremondlars 28 дней назад
React is used when you decide to follow the status quo, Vue is used when you decide to be happy
@Bug-Free
@Bug-Free 28 дней назад
React is opt-out, Vue is opt-in. I said this to ChatGPT, then said choose one of the two: opt-out or opt-in. Then, its answer: Opt-In is generally considered good because it provides a more guided and structured approach, making it easier for developers to adopt best practices and tools gradually. This can simplify the development process and ensure consistency across the project.
@AnthonyChablov
@AnthonyChablov Месяц назад
Another framework from FB we are not gonna talk about XD
@MrJloa
@MrJloa Месяц назад
25:40 the hardest part of this is implementing the actual real life hot.accept method. I know that u used a simplified example where u just rerender the component, but it real-life conditions it would be much harder (like how do restore the props state for the hot swapped component from the parent?)
@LachlanMiller
@LachlanMiller Месяц назад
Yep, and if a component imports a module and the module changes, you need to notify the component, and (maybe) anything importing said component... For framework specific things (like props) some frameworks have some utils. Eg React has fast refresh, integrated here github.com/vitejs/vite-plugin-react/blob/0f7684ae277da8b92da4d98c8eabafe5fc7b18ae/packages/plugin-react/src/fast-refresh.ts#L67 Although this is simplified gotta start somewhere! The next step here would be considering modules (need a module tree) and then framework specific hooks.
@冯珂-k8s
@冯珂-k8s Месяц назад
cool and make sense
@danyboomz
@danyboomz Месяц назад
What do you think about writing it this way ? ``` test.each([ { count: 1, expected: 'odd', }, { count: 2, expected: 'even', }, ])('should test if $count if $expected', async ({ count, expected }) => { const wrapper = mount(app, { props: { count, }, }); expect(wrapper.html()).toContain('Hello, world!'); expect(wrapper.html()).toContain(`Count: ${count} is ${expected}`); }); ```
@LachlanMiller
@LachlanMiller Месяц назад
Very readable, I find these hard to debug if some of the break though, you can't just slap on a `it.only`
@danyboomz
@danyboomz Месяц назад
@@LachlanMiller You could .slice(0, 1) the dataset array but I agree that it's not really convenient !
@thedailycutline278
@thedailycutline278 Месяц назад
The best thing is react devs dont talk about other frameworks being bad, we just build stuff, bcos competitors whos combined framework marketshare dont even come close to half of react usage, keep on yupping about how their framework is better rather than building good projects, what am guessing is vue and svelte cant build great projects and startups, they are the cool kids of frameworks, their users only yup 24/7 how they r better.
@LachlanMiller
@LachlanMiller Месяц назад
I have no idea how you got that impression from this video, I think I gave a pretty good overview of the reactivity systems. In my exp most of the developers I know are pretty happy to work with either React, Vue or whatever other tool is required.
@grzegorzkiselev
@grzegorzkiselev Месяц назад
Up until this comment I thought react devs never yapping
@letscode4277
@letscode4277 Месяц назад
any updates with the book? I've been waiting for it since i subscribed
@LachlanMiller
@LachlanMiller Месяц назад
I'm sorry I haven't been active in this regard. I ended up going back to study part-time and content creation, my hobby, has taken a bit of a back seat. I might just aim for some more videos in the interim... any particular topic that fascinates you, that'd you like to know more about?
@JesseBethke
@JesseBethke Месяц назад
For the Index Types; what I do is define TestingTypes as an enum and TestingType as a `typeof keyof TestingTypes`
@dimitriborgers9800
@dimitriborgers9800 Месяц назад
Super helpful, thank you!
@NoName-tt9ye
@NoName-tt9ye Месяц назад
Great video, I really like the flow of it
@MuhammadIbrahim-x3h
@MuhammadIbrahim-x3h Месяц назад
You have awesome content.I am stuck on a problem plz guide me on I am implementing server-side rendering for a datatable (e.g., blog listing) in my Laravel project. I need to create a JavaScript file for this purpose. Should I place this datatable JS file in the public directory? If so, how do I compile the JS file from the resources directory to the public directory using Laravel Vite?Where should be the file placement in the folder structure. project-root/ ├── resources/ │ ├── js/ │ │ ├── app.js │ │ └── datatable/ │ │ └── blogListing.js ├── public/ │ └── build/ ├── vite.config.js ├── package.json └── ...
@wattsfield1889
@wattsfield1889 Месяц назад
Great vid! Love how you went on the whole journey from just html to more.
@aimanali7877
@aimanali7877 2 месяца назад
Content 🗿
@dimis7096
@dimis7096 2 месяца назад
oh my god friend you will never believe how useful this video was for me and how many concepts you helped me to grasp ! Thank you very much , i love you i wish you the best <3
@LachlanMiller
@LachlanMiller 2 месяца назад
thank you!
@gdifrancesco
@gdifrancesco 2 месяца назад
First of all, great video! I was struggling to find some good comparison as you did, nice job! At 9:26, actually the whole React JSX gets rerendered. That's how React works: whenever a state (useState) changes, the whole function will be executed, including the render/JSX. There are no exceptions on this. There are no actual "dependencies" for the JSX render, it's just about the state changes. It's behind the scenes that React decides whether a node should be "committed" to the DOM, i.e. change the actual DOM nodes: this phase is called "Commit", and it's the last one of the whole rendering process. But this is something we shouldn't care much about as devs, we just have to know that the whole function/component gets re-executed and re-rendered. When you "opt-out" a variable from the reactivity as you said, it just ensures it remains the same (not reassigned, meaning the function inside useMemo is not called) unless an element in the dep array changes (strict equal ===). This is just about expensive computations of that specific variable, therefore it's quite rare to use. Anyway, I loved how deep you dived into these things, which could open up a lot of thoughts into various aspects of both tools. Thanks for the video!
@LachlanMiller
@LachlanMiller 2 месяца назад
thanks for the kind words! sounds like you have a great understanding of this now. worth considering that apparently React has a compiler that changes how rendering works - I'd recommend checking that out to see what's the latest developments in that area.
@cariyaputta
@cariyaputta 2 месяца назад
Thanks. Quality explanation.
@marknielsen4494
@marknielsen4494 2 месяца назад
Excellent
@malcolmvernon6808
@malcolmvernon6808 2 месяца назад
typescript already gives you warnings if you try to edit a const array or object litteral
@LachlanMiller
@LachlanMiller 2 месяца назад
Did not realize this - which tip are you referring to w/ this comment specifically?
@malcolmvernon6808
@malcolmvernon6808 2 месяца назад
@@LachlanMiller In close to the beginning of the video you said to mark const variables "as const" in typescript (first tip actually). And I thought "wow what a cool trick" and then I did an experiment with it and then I was like - WAIT A MIN - typescript already does this out the box without needing to add as const to it. I'm not sure if maybe older typscript versions didn't do that. I tried it mutating both const array and const object litterals and it all gives red warning underlines for it out the box with my tsx files if you try to mutate them
@LachlanMiller
@LachlanMiller 2 месяца назад
@@malcolmvernon6808 I think older versions of TS did not do this, glad it's getting stricter
@TourBD-53
@TourBD-53 2 месяца назад
Hello, I was analyzing your RU-vid channel. your you tube SEO score is zero. It should be increased. and subscribers ,views , like, comments is very low according to your channel age. This is why your you tube growth is very low and your channel setup is also having many problems. If, you can solve this problems your channel will grow and be famous very quickly.
@LachlanMiller
@LachlanMiller 2 месяца назад
thanks
@micahtonning7967
@micahtonning7967 2 месяца назад
Thank you for creating this video. It was extremely helpful.
@menglin7432
@menglin7432 2 месяца назад
Now this is something I'd highly recommend any JS developer to watch
@June-c2q
@June-c2q 2 месяца назад
Great content. Thanks
@AkshyatChapagain
@AkshyatChapagain 2 месяца назад
Just amazing, every new person getting into web dev should watch this video. I can't believe you don't have more subscribers.
@LachlanMiller
@LachlanMiller 2 месяца назад
thanks!
@sangramdesai4295
@sangramdesai4295 2 месяца назад
Nice explanation! I loved how you compared Vue.js and React. Please post a new video explaining how code is compiled in both frameworks step by step
@dimitriborgers9800
@dimitriborgers9800 2 месяца назад
One question: if webpack bundles everything (including third party modules) into bundle.js, doesn't that ever get too big for the browser? The Gatsby library has 1200+ modules; I would assume the bundle.js would be absolutely massive.
@LachlanMiller
@LachlanMiller 2 месяца назад
You can load modules async, so the initial bundle isn't huge. But yes, some libs have really huge bundles - I do not think there is any upper limit, I have worked on apps with 20mb of JS. This takes a long time to parse in the browser. Things like gzip, minify, etc can make it a lot smaller.
@alimaher1
@alimaher1 2 месяца назад
Came here after the beef between Evan You and the guy from TsCoding Haha. Really interesting stuff really. Great video! Thanks, man.
@LachlanMiller
@LachlanMiller 2 месяца назад
what beef?
@alimaher1
@alimaher1 2 месяца назад
@@LachlanMiller ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-96JvriLR4s8.htmlsi=q9UEoAah88cwMcAl I mean this
@cotyhamilton
@cotyhamilton 19 часов назад
Same 😂
@dimitriborgers9800
@dimitriborgers9800 2 месяца назад
This is a phenomenal video, thank you!
@LachlanMiller
@LachlanMiller 2 месяца назад
No problem!
@KousayJebir
@KousayJebir 2 месяца назад
awesome video man ! i do have a quick question tho , when you reached the part of using react and imported React from 'react' what tool was responsible to resolve the location of 'react' or to be more precise the actual location of the file that contains the React object
@LachlanMiller
@LachlanMiller 2 месяца назад
Whatever runtime you are using will resolve modules using its own pre-determined rules. In this video the runtime is Node.js. You can google "node.js module resolution algorithm" or read here. nodejs.org/api/modules.html#loading-from-node_modules-folders In Node.js if the import is not a relative path, it will look in `node_modules` and then find the `package.json` for the module. In there it looks at specific fields like "main", etc.
@KousayJebir
@KousayJebir 2 месяца назад
@@LachlanMiller thank you very much
@metallust
@metallust 2 месяца назад
Actual web development
@DmitriiBaranov-ib3kf
@DmitriiBaranov-ib3kf 2 месяца назад
At least four new allocations on every count update in this React component. And zero in Vue
@LachlanMiller
@LachlanMiller 2 месяца назад
No doubt there is room for optimisation, just an example to illustrate the difference in reactivity systems!
@DmitriiBaranov-ib3kf
@DmitriiBaranov-ib3kf 2 месяца назад
@@LachlanMiller I agree, but there seems to be no room for optimization for Vue reactivity system. Besides, React won't go to this optimization room, so to say, since it'd be a whole paradigm shift. React is based on a flawed immutability-first approach, which causes tons of allocations and loops (both in spreads and dependency array comparisons)
@Ayvengo21
@Ayvengo21 2 месяца назад
It's a bit unclear and i haven't see some good explanation how does vue know that there was a change in some of the ref variables. Like is it some setInterval that check it or some hidden setter function?
@LachlanMiller
@LachlanMiller 2 месяца назад
It creates a map of all dependencies for each reactive effect. See ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-HzhcXVFEiVY.html or lachlan-miller.me/articles/vue-3-reactivity-from-scratch
@vitaliyd23
@vitaliyd23 3 месяца назад
What a gem! Love that you included the error solving parts and the "single take" nature of the video. Liked, subscribed, and added to a playlist)
@handmadegamesdev
@handmadegamesdev 3 месяца назад
Great video. This is exactly the type of breakdown I was looking for.
@oussamareghay7081
@oussamareghay7081 3 месяца назад
Thanks a lot fo the tutorial !
@atlantic_love
@atlantic_love 3 месяца назад
For the Vue side, it appears to me that you have a function called watchEffect, but when the button is clicked it is calling a function named onClick. I don't understand this.
@doylanmihov3939
@doylanmihov3939 25 дней назад
The watchEffect is a VueJs hook/event itself provided by the api, whilst the onClick function is made by the developer and is a arbitrary name he could have called it anything. Since in VueJs 3 there is no longer the seperatation between methods and vue hooks/events so it can be found in the same space.
@chiemekae718
@chiemekae718 3 месяца назад
you got a subscriber here
@chiemekae718
@chiemekae718 3 месяца назад
excellent resources alway hard to show up on searches on RU-vid. You are Amazing mate
@LachlanMiller
@LachlanMiller 3 месяца назад
Thanks!
@rioredwards
@rioredwards 3 месяца назад
This was awesome! Thank you for making this!
@deveshprasad6418
@deveshprasad6418 3 месяца назад
This is amazing. You're a genius. You made it so easy to understand.
@basarat
@basarat 3 месяца назад
Great vid as always 🌹 Wonder if the vue code is valid 🤔 click=onClick …. Fn click=onClick2() …. Value,Void,undefined If it’s invalid, sad that vue doesn’t give an error despite being ts. Might be a big reason why enterprise would choose react 🤷🏻‍♂️