Introduction to Vue3 - Building a Stop Watch Timer (with Composition API)

Поделиться
HTML-код
  • Опубликовано: 1 окт 2024
  • 🤖 SaaS I'm Building: www.icongenera...
    💬 Discord: / discord
    🔔 Newsletter: newsletter.web...
    📁 GitHub: github.com/web...
    📺 Twitch: / webdevcody
    🤖 Website: webdevcody.com
    🐦 Twitter: / webdevcody

Комментарии • 39

  • @gearmaxim
    @gearmaxim Год назад +6

    I really enjoy working with vue, thanks for the video!

  • @oumardicko5593
    @oumardicko5593 Год назад +3

    You can use objects with ref, when on property of you object changes, it will re-render. Unlike in react you don't need to create a new object using restructuring

  • @hsider
    @hsider Год назад +3

    Pretty good demo of VueJs 👌 I would disable the buttons instead of hiding them. I've used Vuejs since it came out and still using it for most of my projects, the separation of JS and HTML made sense to me since I designed a lot of web pages in HTML and CSS so Vuejs makes it easy to add interactivity to those HTML templates without headache.

  • @agcodes
    @agcodes Год назад +1

    what I learnt,
    green light = vue
    blue = react 😂

  • @kylebaker8548
    @kylebaker8548 Год назад +2

    first lol keep up the great content cody!

    • @SeibertSwirl
      @SeibertSwirl Год назад

      Lmaoooooooo ughhhh I woke up late!!! I will be first once again

  • @darialyphia
    @darialyphia Год назад +2

    Also if you want to conditionally render multiple elements, but don't want to wrap them in a div, you can wrap them in a and add the v-if to it ! (this also works with v-for). It's really helpful

    • @WebDevCody
      @WebDevCody  Год назад

      Nice so it’s like fragments kind of

  • @chrisbolson
    @chrisbolson Год назад +1

    I have recently been learning React and Vue (or Anglular) was next on my list.
    This is the first video I have watched regarding View and, having seen your brief intro, I now I wish I had started with Fue before React - it looks so much simpler and closer to Vanilla JavaScript. I look forward to seeing more. Thanks!!

    • @WebDevCody
      @WebDevCody  Год назад +1

      It is much simpler in some aspects.

  • @damjandjordjevic1994
    @damjandjordjevic1994 Год назад

    What would happen if state wasn't a ref? I get confused when I should use a ref and when I shouldn't...

    • @WebDevCody
      @WebDevCody  Год назад +1

      with composition api, you use ref when you need dynamic state. If you just have a constant you could just declare a normal const variable at the top of the script

  • @shakapaker
    @shakapaker Год назад +1

    pnpm v8 🥰

  • @karlstenator
    @karlstenator Год назад

    This is perfect timing! I'm both learning Vue 3 and building a hobby timing project for my running club. Most excellent. 🏆

  • @tobychidi
    @tobychidi Год назад

    Green light looks cool

  • @darialyphia
    @darialyphia Год назад +1

    npm i @vueuse/core
    import { useIntervalFn } from '@vueuse/core'
    vueuse ie too goated 😄

  • @lebroncarmelo1523
    @lebroncarmelo1523 Год назад

    In my opinion vue has gradually declined

  • @marcoss4563
    @marcoss4563 Год назад

    nice! ty!

  • @bughlinjo9372
    @bughlinjo9372 Год назад +1

    hello cody i just started learning react and i have a question. i have header and nav in seperate files and i want to import increment function in header. i can,t seem to do it. can you help me?

    • @WebDevCody
      @WebDevCody  Год назад

      Where is your increment function declared? You probably need to put the increment function in a separate file and export it. Then any vue components could use it. Your increment file would also have a count ref which other components could import

    • @bughlinjo9372
      @bughlinjo9372 Год назад

      @@WebDevCody i use react/vite and i declared increment function with useState in a seperate file and exported it than i used it onclick={} on button and than i need to use {count} in a seperate file for number to go up but when i use {count } it says word cannot be found.

    • @rajusharma823
      @rajusharma823 Год назад

      pass it as props. join the discord people may help you there. :)

    • @bughlinjo9372
      @bughlinjo9372 Год назад

      @@rajusharma823 oh than i have to learn that thanks

    • @rookie549
      @rookie549 Год назад

      @@bughlinjo9372 React Context

  • @hanes2
    @hanes2 Год назад

    I'm using vue which is nice, trying out Nuxt.

  • @mrkanata7696
    @mrkanata7696 Год назад

    good video. What is your vscode theme ?

  • @piotrm98
    @piotrm98 Год назад

    I have a question, I did same app in React yesterday and i have a problem that when you switch to a different tab in your browser then your stopwatch stops. I read that its an optimization thing that browser does. Do you know how to get around this?

    • @WebDevCody
      @WebDevCody  Год назад +1

      You’d need to store a timestamp when you click start, then calculate the diff between the start and now, then display the diff formatted

    • @gregconen
      @gregconen Год назад

      Really, you should do that anyway; if you just use setInterval, you can lose time even in an active tab if the browser is busy with something else. But the timing mechanism is not the point of the video.

  • @adrianfr05
    @adrianfr05 Год назад

    Next svelte 👀

  • @OlegSim-b3g
    @OlegSim-b3g Год назад

    vue content 👍

  • @oumardicko5593
    @oumardicko5593 Год назад +1

    You could have used a computed value that will update the text depending on the state. And on single function which will do an action depending on the state too 🤔.
    We would have violated the single responsibility principle but it works

    • @WebDevCody
      @WebDevCody  Год назад

      Oh so you mean use a watch that listens for the timer state and run different code depending on the new value? Yeah a computed would help cache the timer output, but with this small scale of app I don’t think it would really make a difference

    • @oumardicko5593
      @oumardicko5593 Год назад

      @@WebDevCody you have quite a few ways to do this

  • @kakun7238
    @kakun7238 Год назад

    what about nuxt

    • @WebDevCody
      @WebDevCody  Год назад

      yeah I'll probably use that with v3 app soon as well