React useState() hook introduction 🎣

Поділитися
Вставка
  • Опубліковано 19 чер 2024
  • #reactjs #course #tutorial
    00:00:00 introduction
    00:01:10 setup
    00:01:57 import useState
    00:02:25 update a string
    00:05:38 initial state
    00:05:58 increment a number
    00:07:29 toggle a boolean
    00:09:24 Counter program
    00:13:14 Counter CSS
    00:16:03 conclusion
    // React hook = Special function that allows functional components
    // to use React features without writing class components
    // (useState, useEffect, useContext, useReducer, and more...)
    // useState() = A React hook that allows the creation of a stateful variable
    // AND a setter function to update its value in the Virtual DOM.
    // [name, setName]

КОМЕНТАРІ • 34

  • @BroCodez
    @BroCodez  7 місяців тому +9

    // React hook = Special function that allows functional components
    // to use React features without writing class components
    // (useState, useEffect, useContext, useReducer, and more...)
    // useState() = A React hook that allows the creation of a stateful variable
    // AND a setter function to update its value in the Virtual DOM.
    // [name, setName]
    import MyComponent from './MyComponent.jsx'
    import Counter from './Counter.jsx'
    function App() {
    return();
    }
    export default App
    import React, {useState} from 'react';
    function MyComponent(){
    const [name, setName] = useState("Guest");
    const [age, setAge] = useState(0);
    const [isEmployed, setIsEmployed] = useState(false);

    const updateName = () => {
    setName("Spongebob");
    }
    const incrementAge = () => {
    setAge(age + 1);
    }
    const toggleEmployedStatus = () => {
    setIsEmployed(!isEmployed);
    }
    return(
    Name: {name}
    Set Name
    Age: {age}
    Increment Age
    Is employed: {isEmployed ? "Yes" : "No"}
    Toggle Status
    );
    }
    export default MyComponent
    import React, {useState} from 'react';
    function Counter(){
    const [count, setCount] = useState(0);
    const increment = () => {
    setCount(count + 1);
    }
    const decrement = () => {
    setCount(count - 1);
    }
    const reset = () => {
    setCount(0);
    }
    return(
    {count}
    Decrement
    Reset
    Increment
    );
    }
    export default Counter
    .counter-container{
    text-align: center;
    font-family: Arial, sans-serif;
    }
    .count-display{
    font-size: 10em;
    margin-top: 0;
    margin-bottom: 50px;
    }
    .counter-button{
    width: 150px;
    height: 50px;
    font-size: 1.5em;
    font-weight: bold;
    margin: 0px 5px;
    background-color: hsl(197, 100%, 58%);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    }
    .counter-button:hover{
    background-color: hsl(197, 100%, 48%);
    }

    • @Soap029
      @Soap029 7 місяців тому

      Tried using your c sharp programming tutorial. It did help . Btw are u s software developer?

    • @Cosmos_the_stardust
      @Cosmos_the_stardust 6 місяців тому

      Please Upload more React videos. If possible, it will help me a lot.

  • @markgesaka8836
    @markgesaka8836 4 місяці тому +7

    He's intelligent than ChatGPT...He explains everything in a way that is easy to understand!

  • @abzz1290
    @abzz1290 7 місяців тому +4

    16:32 minutes of pure fun, clear, and understandable knowledge. thanks, bro

  • @Chrisalex_
    @Chrisalex_ 6 місяців тому

    Thank you! Completing your course was exceptional; your teaching stands out

  • @janlim9374
    @janlim9374 11 днів тому

    You are very good at explaining concepts

  • @theycallmepyro1014
    @theycallmepyro1014 Місяць тому

    Thanks, you explained this really clearly and helped me get over the hump when first learning about useState.

  • @jkbullitt8986
    @jkbullitt8986 5 місяців тому

    Superior tutorial. Crisp, Clear, and Concise🔥

  • @michagwizdek5612
    @michagwizdek5612 7 днів тому

    Thank you! simple, yet awesome.

  • @Bidisa_Kalita_
    @Bidisa_Kalita_ 7 місяців тому +1

    please upload other react topics asap, this is the best playlist🤠

  • @tee-hee9553
    @tee-hee9553 7 місяців тому +1

    The more I learn react The more I kind of feel fun I mean entertain from your video haha that was fun

  • @ahmedmamun6832
    @ahmedmamun6832 5 місяців тому

    Thank you Bro. It's very much easy and helpful after watching the video

  • @privatesoul
    @privatesoul 3 місяці тому

    Thanks, man, you nailed it.

  • @xzex2609
    @xzex2609 6 місяців тому

    Bro is exceptional , the best teacher I had . I wish that he had a Django course too . unfortunately even though he is great at python , but he prefers JS for web development may be he teach some back end development on python

  • @saurabhmhatre5574
    @saurabhmhatre5574 4 місяці тому

    Loved it!!

  • @nemesisxl6736
    @nemesisxl6736 7 місяців тому

    Thank you Bro for your simple and great React lesson, as always! Could you please speed up your React lessons? Thank you again!

  • @eshuvlogs7981
    @eshuvlogs7981 4 місяці тому

    ❤❤❤ THANK YOU

  • @Yesterday_i_ate_rat
    @Yesterday_i_ate_rat 6 місяців тому

    Finally, I understood useState hook

  • @nihongo_
    @nihongo_ 6 місяців тому

    keep doing what u doing 👍

  • @kathikr9360
    @kathikr9360 3 місяці тому

    thanks man

  • @I_am_Ragupathi
    @I_am_Ragupathi 6 місяців тому

    come on come on...dude...!!!!!! you are always awesome

  • @MustaphaSabri-jw6ds
    @MustaphaSabri-jw6ds 19 днів тому

    👏👏

  • @MoreRealMxnny
    @MoreRealMxnny 6 місяців тому

    will this be full course soon? Thanks again for this !

  • @volodyslove
    @volodyslove 7 місяців тому

    more i need more react 😁😁😁

  • @kingcat4708
    @kingcat4708 7 місяців тому

    cant wait to watch django tuturial from bro 😀

    • @kingcat4708
      @kingcat4708 6 місяців тому

      anything is better if bro teaches @@doublekamui

  • @manideepak1492
    @manideepak1492 4 місяці тому

    Bro Plz do a React Native tutorial

  • @epixor_ed
    @epixor_ed 7 місяців тому

    Kotlin Language Tutorials Please Bro Code

  • @crackrokmccaib
    @crackrokmccaib 6 місяців тому

    Is it just me, or does your voice sound different?

    • @Baryon-ms1co
      @Baryon-ms1co 5 місяців тому

      It's the same, one thing there's no background noises as usual

  • @bravin_w
    @bravin_w 7 місяців тому

    Where did captain hook buy his hook?
    A second hand store 😂

  • @tonytodd7011
    @tonytodd7011 7 місяців тому

    Thank you Bro for your simple and great React lesson, as always! Could you please speed up your React lessons? Thank you again!

    • @nemesisxl6736
      @nemesisxl6736 7 місяців тому +1

      Agreed, I just started learning React and I want more content D: