- 174
- 508 767
Lachlan Miller
Australia
เข้าร่วมเมื่อ 18 ส.ค. 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
มุมมอง: 4 713
วีดีโอ
Visual Guide to the Modern Frontend Toolchain (Vite)
มุมมอง 90K10 หลายเดือนก่อน
🎉 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
มุมมอง 1.1K11 หลายเดือนก่อน
🎉 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
มุมมอง 6K11 หลายเดือนก่อน
🎉 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
มุมมอง 8K11 หลายเดือนก่อน
🎉 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
มุมมอง 5K11 หลายเดือนก่อน
📗 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
มุมมอง 1.4K11 หลายเดือนก่อน
📗 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
มุมมอง 8Kปีที่แล้ว
❗️ 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
มุมมอง 2.2Kปีที่แล้ว
👉 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
มุมมอง 43Kปีที่แล้ว
📗 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)
มุมมอง 1.3K2 ปีที่แล้ว
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)
มุมมอง 6732 ปีที่แล้ว
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)
มุมมอง 5852 ปีที่แล้ว
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)
มุมมอง 6062 ปีที่แล้ว
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 th-cam.com/video/uCsD3ZGzMgE/w-d-xo.html 🎄 Advent of Vue: adventofvue.com/ 💻 Code: github.com/lmiller1990/aov2022/tree/aov-12-josephus 🐦 Keep up with me on Twitter! twitter.c...
Arbitrary Values & Properties in Tailwind (Advent of Vue #11)
มุมมอง 6322 ปีที่แล้ว
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)
มุมมอง 1.8K2 ปีที่แล้ว
TDD, TypeScript Tricks and Sorting (Advent of Vue #9)
Composables and Functional Logic (Advent of Vue #6)
มุมมอง 1.9K2 ปีที่แล้ว
Composables and Functional Logic (Advent of Vue #6)
For Loops? Recursion? (Advent of Vue #4)
มุมมอง 1.2K2 ปีที่แล้ว
For Loops? Recursion? (Advent of Vue #4)
Simple Functions and Conditionals (Advent of Vue #2)
มุมมอง 8152 ปีที่แล้ว
Simple Functions and Conditionals (Advent of Vue #2)
Fetching and Debounce in Vue (Advent of Vue #1)
มุมมอง 2.4K2 ปีที่แล้ว
Fetching and Debounce in Vue (Advent of Vue #1)
Cypress CT 5/8 - Asserting Again Emitted Events
มุมมอง 6282 ปีที่แล้ว
Cypress CT 5/8 - Asserting Again Emitted Events
Cypress CT 3/8 - Building a Better Mount
มุมมอง 7772 ปีที่แล้ว
Cypress CT 3/8 - Building a Better Mount
Cypress CT 1/8 - Diving in the Deep End with Cypress Component Testing
มุมมอง 5K2 ปีที่แล้ว
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
มุมมอง 4682 ปีที่แล้ว
Cypress CT 8/8 - Better Type Safety, cy.mount & CT at Cypress
Cypress CT 2/8 - A Useful Pattern for Wrapping Components
มุมมอง 1.5K2 ปีที่แล้ว
Cypress CT 2/8 - A Useful Pattern for Wrapping Components
Cypress CT 6/8 - Forms & Intercepting Requests
มุมมอง 4582 ปีที่แล้ว
Cypress CT 6/8 - Forms & Intercepting Requests
Cypress CT 4/8 - The Seam Between CT & E2E Tests
มุมมอง 4952 ปีที่แล้ว
Cypress CT 4/8 - The Seam Between CT & E2E Tests
Was asked about the exact same question during the interview, had no idea then end up bombing it. This video explains so much in a clearest way possible! Definitely saves me from future interviews. Thanks!
Great video, vue only render when the value is change and opt-in in the template, and react re-render everything and use "use" to opt-out them.
You are absolutely brilliant! Thank you.
Thanks
Thank you so much. The graph makes it much easier to understand.
Wish i watched it before learning it the hard way))
THIS IS AMAZING!!! I've been looking for a way to trace and understand the journey to our current setup and there's just so many different parts to it that I've just never managed to understand how all fell into place. This video explains all of that in almost an ELI5 way and covers almost everything needed! Thank you so much for this!
3:00 I don't think its fair to say that "React is just JavaScript". React exports a function, which you may expect to be invoked serveral times. While Vue is defining top-level JS, which you'd expect to be executed only once. It is quite trivial to make Vue do the same thing as React, while it's non-trivial with growing complexity to prevent React from re-invoking the component.
I think by "just javascript" it means there isn't any additional compiler like vue has for the .vue file, it's really what you see is what you get (except the JSX compile...) but I agree that the Vue model is a bit more intuitive, at least to me
Never had I understood babel soo deeply. Kudos to you man!!
Why use events here?
I think it works okay, any better recommendation?
@@LachlanMiller What if not introduce Event Emitter and leave handling describe and it methods inside those methods. Can't you fill the handlers object right from describe and it functions?
@@ukostin123 maybe, I might need more info to understand. One benefit of doing a full pass and collecting the events if we can easily add `.only` feature later on - which requires a full pass of all suites before we start executing. You might be able to avoid using event emitter, I'm sure there are other approaches. If you can do it, please share your implementation!
Thank you for sharing this. I find it very informative for every new developer to understand where all things came from and why it evolved that way.
You inlined count++ in react code but used a function in vue. So vue version looks more verbose. In fact, vue's code mostly less verbose than react's.
Amazing
Vue 3 has fragment built-in on root, so you can have multiple html tags under root, I.e. No need to wrap it in div 🎉🎉
it's true!
I love and use Vue because it does not use JSX
thank you sir
Is incredible how react is the most used framework when it is a pile pf 💩
Nice tutorial. How did you run both react and vue at the same time?
Great video!
It’s actually a confuse from vue 3 composition API, when use the old vue 2 way, options API then it make you instant clear and understand why it doesn’t double the count value
Briliant video . Thnx
Such a great video ❤
I just forced myself to watch whole video, and it was good
I think the author missed the key point why react's way is just wrong. It is spelled out in the code but wasn't mentioned explicitly in the narrative. The point is, that frameworks should do things for us, not us instructing the framework each time over and over again what makes sense. In the presented example it is the developer who needs to keep track of the dependencies (much like Ember.js does) whereas with Vue, because you tell it what is reactive, it can keep track of the dependencies itself. This means that if the callback to watchEffect will change and suddenly will have more reactive state being used in it, then there is no need to further tell Vue what should influence the re-execution of said callback. The bottom line is that working with React is a constant struggle of "why isn't this thing re-rendering" vs in Vue it's "I want this to just work and I don't care how it is doing its magic"
very clear explanation
You could have just used inline for count increment on both.
Thanks for clear and concise explanation! I'm working in both React and Vue but never think of their difference in this way.
Amazing in-depth look at the build system, thank you
Composables are the simplest. Pinia is the best in most cases.
Excellent explanation!
thanks man 😎
Which version of vue test utils did you use? Since this is 4 years old, I'm trying to check if there's been significant changes where following along with this won't be helpful. Thank you
No major changes to Test Utils - I'm the author of it and we have never and any major breaking changes. what issue are youhaving?
where's the book man? I've been waiting for some time! Good luck with it.
I will work on it again soon. I ended up going back to college for a masters which consumed my whole life but that will finish mid Nov!!
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.
webpack was built FOR react. aside from that, great content we've been building on complicated frontends for a while before webpack
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
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?
@@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.
@@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!
what is opt in actually?
0:51 is the best part of the video
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.
thank you, this is extremely helpful and clear.
Great run through!! Helps wrap my head around things.
Pretty cool video :)
React is used when you decide to follow the status quo, Vue is used when you decide to be happy
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.
Another framework from FB we are not gonna talk about XD
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?)
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.
cool and make sense
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}`); }); ```
Very readable, I find these hard to debug if some of the break though, you can't just slap on a `it.only`
@@LachlanMiller You could .slice(0, 1) the dataset array but I agree that it's not really convenient !
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.
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.
Up until this comment I thought react devs never yapping
any updates with the book? I've been waiting for it since i subscribed
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?
For the Index Types; what I do is define TestingTypes as an enum and TestingType as a `typeof keyof TestingTypes`