![Lachlan Miller](/img/default-banner.jpg)
- 174
- 457 164
Lachlan Miller
Australia
Registrace 18. 08. 2020
I make content about Vue.js, JavaScript and testing. I try to upload or release a new video every day.
How Hot Module Replacement REALLY Works | JS Toolchain From Scratch
🎉 NEW book on tooling (build your own tools!) Coming 2024, register for updates): lachlan-miller.ck.page/92dfa021b3
⚠️ NOTE: I refer to HMR as Hot Module RELOAD - it's actually "Replacement", I had been saying in wrong for years.
🐦 My Twitter: Lachlan19900
✏️ Diagram/notes from video: app.eraser.io/workspace/W1ZOWqpCPrv4Vz2vcytS?origin=share
🔨 I am building an entire JS toolchain from (mostly) scratch. In this video, we lay the foundations and build out a naive but simple and functional hot module replacement (HMR) implementation.
Source: github.com/lmiller1990/build-your-own-vite/tree/main
⚠️ NOTE: I refer to HMR as Hot Module RELOAD - it's actually "Replacement", I had been saying in wrong for years.
🐦 My Twitter: Lachlan19900
✏️ Diagram/notes from video: app.eraser.io/workspace/W1ZOWqpCPrv4Vz2vcytS?origin=share
🔨 I am building an entire JS toolchain from (mostly) scratch. In this video, we lay the foundations and build out a naive but simple and functional hot module replacement (HMR) implementation.
Source: github.com/lmiller1990/build-your-own-vite/tree/main
zhlédnutí: 3 313
Video
Visual Guide to the Modern Frontend Toolchain (Vite)
zhlédnutí 79KPřed 5 měsíci
🎉 NEW book on tooling (build your own tools!) Coming 2024, register for updates): lachlan-miller.ck.page/92dfa021b3 🐦 My Twitter: Lachlan19900 ✏️ Diagram/notes from video: app.eraser.io/workspace/1CfLxNLf9DY9E9Ndesq4?origin=share I talk about Vite, the best toolchain for building frontend apps right now, which combines a number of other tools under the hood with with some extra good...
How To Debug Infuriating Module Errors
zhlédnutí 909Před 5 měsíci
🎉 NEW book (coming 2024, register for updates): lachlan-miller.ck.page/92dfa021b3 📗 Current Book (Vue, Updated Aug 2023): lachlanmiller.gumroad.com/l/vuejs-design-patterns 🐦 My Twitter: Lachlan19900 🧠 Useful Links - Why you should ALWAYS use an extension: lachlan-miller.me/articles/why-you-should-always-use-an-extension-for-javascript-files - Node's creator regrets about module exte...
Vue's New Rendering Strategy (Vapor), Innovation vs Maintenance
zhlédnutí 6KPřed 6 měsíci
🎉 NEW book (coming 2024): lachlan-miller.ck.page/92dfa021b3 📗 Book (Vue, Updated Aug 2023): lachlanmiller.gumroad.com/l/vuejs-design-patterns 🐦 My Twitter: Lachlan19900 Today I talk about Vue's new rendering stategy, Vapor mode, performance, and more broadly the implications of innovation vs maintenance in the JS community. 🧠 References: - github.com/sveltejs/svelte/issues/2546 - va...
My Favorite TypeScript Tips and Tricks
zhlédnutí 6KPřed 6 měsíci
🎉 Writing a book about tooling, testing and development philosophy: lachlan-miller.ck.page/92dfa021b3 📗 Book (Vue, Updated Aug 2023): lachlanmiller.gumroad.com/l/vuejs-design-patterns Type Challenges to learn and push yourself github.com/type-challenges/type-challenges 🐦 My Twitter: Lachlan19900 Some neat TypeScript tips and tricks I've learned over the years. Now you know them, too!
3 Ways to Avoid Prop Drilling in Vue/React
zhlédnutí 4,4KPřed 6 měsíci
📗 Book (Updated Aug 2023): lachlanmiller.gumroad.com/l/vuejs-design-patterns 🎉 Writing a book about tooling, testing and development philosophy: lachlan-miller.ck.page/92dfa021b3 🐦 Twitter: Lachlan19900 Sick of passing props to deeply nested components? Here's a few alternatives I've used over the years, with my thoughts and recommendations.
Form Validation Strategies for JavaScript Apps
zhlédnutí 1,2KPřed 6 měsíci
📗 Book (Updated Aug 2023): lachlanmiller.gumroad.com/l/vuejs-design-patterns 🎉 Writing a book about tooling, testing and development philosophy: lachlan-miller.ck.page/92dfa021b3 🐦 Twitter: Lachlan19900 Some different approaches to validating forms I've seen over the years with my thoughts.
The Mighty Deferred Promise - An Interview Recount
zhlédnutí 8KPřed 8 měsíci
❗️ See the comments - I over-engineered this, my solution is far from ideal. Good discussion in comments! 👉 I am writing a book on tooling! Check it out: lachlan-miller.ck.page/92dfa021b3 🐦 Lachlan19900 I had an interview recently which featured an interesting question. In this video, I share the question and my solution, along with a construct, the mighty deferred promise. There's ...
Patterns for Error Handling
zhlédnutí 1,9KPřed 8 měsíci
👉 I am writing a book! Check it out: lachlan-miller.ck.page/92dfa021b3 📗Book on Design Patterns: lachlanmiller.gumroad.com/l/vuejs-design-patterns 🐦 Lachlan19900 In this video, I share some thoughts and techniques about error handling in a little application I'm working on.
The Difference Between Vue and React
zhlédnutí 33KPřed 10 měsíci
📗 Book (Updated Aug 2023): lachlanmiller.gumroad.com/l/vuejs-design-patterns 🐦 Twitter: Lachlan19900 Today I talk about the philosophical difference between Vue and React and how it impacts the reactivity system of the two frameworks.
Renderless Component & Type Safety (Advent of Vue #17)
zhlédnutí 1,2KPřed rokem
My solution to the 17th and final Advent of Vue challenge! Good one to end on - renderless components are a great example of separation of concerns. We also talk about pushing logic out of a component into a stateless function. I also talk about renderless components in my book: lachlan-miller.me/design-patterns-for-vuejs 👉 Link to algorithm www.movable-type.co.uk/scripts/latlong.html 👉 Haversi...
Type Safe Custom Directives (Advent of Vue #16)
zhlédnutí 627Před rokem
My solution to the 16th Advent of Vue challenge! Pretty quick one, and something that doesn't get as much attention as it probably deserves - custom directives. 🎄 Advent of Vue: adventofvue.com/ 💻 Code: github.com/lmiller1990/aov2022/tree/christmas-done 🐦 Keep up with me on Twitter! Lachlan19900 If you like my teaching style, I have a book and two courses! 👀 (Book) Design Patterns f...
Shuffling Arrays and a Map Trick (Advent of Vue #14)
zhlédnutí 556Před rokem
My solution to the 14th Advent of Vue challenge! New favorite - we get to talk about shuffling algorithms and the the jankiness of Array.prototype.sort. 👉 Fisher Yates Shuffle: en.wikipedia.org/wiki/Fisher–Yates_shuffle 🎄 Advent of Vue: adventofvue.com/ 💻 Code: github.com/lmiller1990/aov2022/tree/14-done 🐦 Keep up with me on Twitter! Lachlan19900 If you like my teaching style, I hav...
Solving a 2000 Year Old Problem with TDD and Vue (Advent of Vue #12)
zhlédnutí 583Před rokem
My solution to the 12th Advent of Vue challenge! This was my favorite one so far! Explaining this in a short video while coding was difficult, I hope it's not too difficult too confusing 🤯 👉 Numberphile on Josephus Problem czcams.com/video/uCsD3ZGzMgE/video.html 🎄 Advent of Vue: adventofvue.com/ 💻 Code: github.com/lmiller1990/aov2022/tree/aov-12-josephus 🐦 Keep up with me on Twitter! twitter.co...
Arbitrary Values & Properties in Tailwind (Advent of Vue #11)
zhlédnutí 608Před rokem
My solution to the 11th Advent of Vue challenge! Some neat Tailwind tips and tricks. 🎄 Advent of Vue: adventofvue.com/ 💻 Code: github.com/lmiller1990/aov2022/tree/aoc-11-twinkle-solution 🐦 Keep up with me on Twitter! Lachlan19900 If you like my teaching style, I have a book and two courses! 👀 (Book) Design Patterns for Vue.js: lachlan-miller.me/design-patterns-for-vuejs (YT_5_OFF fo...
TDD, TypeScript Tricks and Sorting (Advent of Vue #9)
zhlédnutí 1,7KPřed rokem
TDD, TypeScript Tricks and Sorting (Advent of Vue #9)
Composables and Functional Logic (Advent of Vue #6)
zhlédnutí 1,8KPřed rokem
Composables and Functional Logic (Advent of Vue #6)
For Loops? Recursion? (Advent of Vue #4)
zhlédnutí 1,1KPřed rokem
For Loops? Recursion? (Advent of Vue #4)
Simple Functions and Conditionals (Advent of Vue #2)
zhlédnutí 800Před rokem
Simple Functions and Conditionals (Advent of Vue #2)
Fetching and Debounce in Vue (Advent of Vue #1)
zhlédnutí 2,3KPřed rokem
Fetching and Debounce in Vue (Advent of Vue #1)
Cypress CT 5/8 - Asserting Again Emitted Events
zhlédnutí 590Před rokem
Cypress CT 5/8 - Asserting Again Emitted Events
Cypress CT 3/8 - Building a Better Mount
zhlédnutí 714Před rokem
Cypress CT 3/8 - Building a Better Mount
Cypress CT 1/8 - Diving in the Deep End with Cypress Component Testing
zhlédnutí 4,7KPřed rokem
Cypress CT 1/8 - Diving in the Deep End with Cypress Component Testing
Cypress CT 8/8 - Better Type Safety, cy.mount & CT at Cypress
zhlédnutí 424Před rokem
Cypress CT 8/8 - Better Type Safety, cy.mount & CT at Cypress
Cypress CT 2/8 - A Useful Pattern for Wrapping Components
zhlédnutí 1,4KPřed rokem
Cypress CT 2/8 - A Useful Pattern for Wrapping Components
Cypress CT 6/8 - Forms & Intercepting Requests
zhlédnutí 428Před rokem
Cypress CT 6/8 - Forms & Intercepting Requests
Cypress CT 4/8 - The Seam Between CT & E2E Tests
zhlédnutí 464Před rokem
Cypress CT 4/8 - The Seam Between CT & E2E Tests
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
thank you!
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!
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.
Thanks. Quality explanation.
Excellent
typescript already gives you warnings if you try to edit a const array or object litteral
Did not realize this - which tip are you referring to w/ this comment specifically?
@@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
@@malcolmvernon6808 I think older versions of TS did not do this, glad it's getting stricter
Hello, I was analyzing your CZcams 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.
thanks
Thank you for creating this video. It was extremely helpful.
Now this is something I'd highly recommend any JS developer to watch
Great content. Thanks
Just amazing, every new person getting into web dev should watch this video. I can't believe you don't have more subscribers.
thanks!
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
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.
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.
Came here after the beef between Evan You and the guy from TsCoding Haha. Really interesting stuff really. Great video! Thanks, man.
what beef?
@@LachlanMiller czcams.com/video/96JvriLR4s8/video.htmlsi=q9UEoAah88cwMcAl I mean this
This is a phenomenal video, thank you!
No problem!
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
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.
@@LachlanMiller thank you very much
Actual web development
At least four new allocations on every count update in this React component. And zero in Vue
No doubt there is room for optimisation, just an example to illustrate the difference in reactivity systems!
@@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)
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?
It creates a map of all dependencies for each reactive effect. See czcams.com/video/HzhcXVFEiVY/video.html or lachlan-miller.me/articles/vue-3-reactivity-from-scratch
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)
Great video. This is exactly the type of breakdown I was looking for.
Thanks a lot fo the tutorial !
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.
you got a subscriber here
excellent resources alway hard to show up on searches on CZcams. You are Amazing mate
Thanks!
This was awesome! Thank you for making this!
This is amazing. You're a genius. You made it so easy to understand.
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 🤷🏻♂️
This is gold
I'm glad this video exists
thanks I am glad you exist and watched it!
Nice video ❤ However you don’t need a deferred promise for this. I’ll be happy to edit the code for you if you post a gist 🌹🫰🏻
Heya, thanks for the comment, we discussed this already in the pinned comment
@@LachlanMiller I see it now, Perfect 🌹
0:47 not very important but potentially good habit/convention for both readability (separation of concerns) and consistency with vue's approach: you can extract the anonymous function from the jsx into an appropriately named const and then just simply pass it in the jsx event. this way any changes you make to the logic will be done in the logic part of the code (just like in vue) and if you are writing a more complex function it would look ugly and clutter the jsx. this way, simple or complex, your logic consistently shows up where its expected and you and your team will frown less :] edit: the reason i mention consistency with vue is that its easier to switch or be good at both the more similar they are, in general
Great video but I think your explanation at 9:40 may cause someone to think React does not return "new" JSX
Hello Miller. Really am v happy from your channel. can you please make one medium TDD application? OR If you have means, can you share it with me ?
hi, are you asking for an example project with lots of tests? Are you looking for Test Utils specifically?
@@LachlanMiller yes. Am looking for project with all test cases
This one has some, check it out github.com/lmiller1990/vuejs-composition-api-course/tree/main/tests/unit
@@LachlanMiller Thank you v much 😍
Really very nice.. Thank you so much miller 🥰
Really great video
thanks!
Beautiful
thanks' a lot man <3
How are you managing to run Vue and React at the same time? Are you utilizing micro-frontend technology on this example?
No, I just import them both and mount the apps on different DOM elements. Eg <div><div id='react' /><div id='vue' /></div>
Finally someone that explains the problem that is being solved by these stupid installs lol. 10/10 vid.
This is great, thanks!
a lot of react slander on the CS. i am still a react fan. but this video is a good comparison between both.
I think they’re both great!
"We're not sane, we're INSANE, we're modern web developers" LMAOOO
❤
Nice overview, as always! I'm doing a refactor of a legacy Rails app form to Vue and we have a mix of "Server config driven" + "Reward Early". We didn't want to discard the existing base field "rules schema" coming from the backend but, at the same time, we want to improve UX as the form is very complex/big/stepped. From my experience, the major problem with the "Server config driven" was dynamic/conditional field validation: a "field B" is required only if "field A" has a certain value. This led to duplication on the front end as we didn't find any good solution to share those rules and is indeed a source of bugs/inconsistencies. In some cases where the validation logic was so complex, we drop the client-side validation of that field and render the error only after validating on the server, so it is more of a hybrid approach! Thanks for another insightful video! Keep it up!
I hadn't thought of the related field validation - eg only require field A when field B is checked, or something. Thanks for the comment, very insightful. Why are forms still so tedious in 2024 🤯
why god , why
You've got my subscribe. More videos like this please!
Great
Another useless feature. Vue project built 2 years ago is totally obsolete and doesnt work anymore. Talk about reliability, total failure. Next please
Code doesn't just stop working - unless the environment changed, it should be fine. Docker solves this problem! What is the issue, I might be able to help you debug?
Good explanation! Thanks
Great stuff. I am starting to hook on Vite. One important thing I hope Vite had out of box is Module Federation, which is quite essential to build micro-frontend. Do you have any idea how to build micro-frontend with Vite?
Not sure about micro frontends! I have not worked with those before. Let me know iff you find out!