React useRef() hook introduction 🗳️

แชร์
ฝัง
  • เผยแพร่เมื่อ 8 ก.ย. 2024

ความคิดเห็น • 35

  • @BroCodez
    @BroCodez  8 หลายเดือนก่อน +9

    // useState() = Re-renders the component when the state value changes
    // useRef() = "use Reference" Does not cause re-renders when its value changes.
    // 1. Accessing/Interacting with DOM elements
    // 2. Handling Focus, Animations, and Transitions
    // 3. Managing Timers and Intervals
    import React, {useState, useEffect, useRef} from 'react';
    function MyComponent(){
    const inputRef1 = useRef(null);
    const inputRef2 = useRef(null);
    const inputRef3 = useRef(null);
    useEffect(() => {
    console.log("COMPONENT RENDERED");
    });
    function handleClick1(){
    inputRef1.current.focus();
    inputRef1.current.style.backgroundColor = "yellow";
    inputRef2.current.style.backgroundColor = "";
    inputRef3.current.style.backgroundColor = "";
    }
    function handleClick2(){
    inputRef2.current.focus();
    inputRef1.current.style.backgroundColor = "";
    inputRef2.current.style.backgroundColor = "yellow";
    inputRef3.current.style.backgroundColor = "";
    }
    function handleClick3(){
    inputRef3.current.focus();
    inputRef1.current.style.backgroundColor = "";
    inputRef2.current.style.backgroundColor = "";
    inputRef3.current.style.backgroundColor = "yellow";
    }
    return (


    Click me 1!



    Click me 2!



    Click me 3!



    );
    }
    export default MyComponent;

    • @lonelydevilcreations
      @lonelydevilcreations 7 หลายเดือนก่อน +1

      Plz make redux and context API videos

    • @iiTzBlaster
      @iiTzBlaster 7 หลายเดือนก่อน

      Hi BroCode! I'm reaching out because I'd like to contact you further. Could you share your email or Discord or something similar? I have some questions, ideas, and feedback I'd like to discuss. Looking forward to hearing from you!

    • @-_SleepAndEat_-
      @-_SleepAndEat_- 4 หลายเดือนก่อน

      Bro can you do Kali Linux ?

  • @JohnWickXD
    @JohnWickXD 6 หลายเดือนก่อน +6

    That's hands on the best explanation of useRef( ). Thanks again Bro

  • @valerylouis6747
    @valerylouis6747 8 หลายเดือนก่อน +4

    always happy with tutorials from Bro Code. much respect!

  • @muhammadumarsotvoldiev8768
    @muhammadumarsotvoldiev8768 3 หลายเดือนก่อน +1

    Thank you very much From Uzbekistan Fergana 👍

  • @domkar4186
    @domkar4186 7 หลายเดือนก่อน +1

    Really very good content which we needed... useful in our work..thanks buddy....❤

  • @kathikr9360
    @kathikr9360 4 หลายเดือนก่อน

    i have seen multiple classes and yours is clear and .Thank You

  • @zuhabaw9976
    @zuhabaw9976 6 หลายเดือนก่อน +1

    just 178 likes???? are you kidding me?? This is the best tutorial video on useRef hook🥺
    No doubt all the videos from this channel are great but this one is just too clear and simple!
    feeling bad for the people who didn't/ couldn't find this video

  • @user-fb9yy3qb1o
    @user-fb9yy3qb1o 6 หลายเดือนก่อน +1

    Love it

  • @Hari-ce4wx
    @Hari-ce4wx 4 หลายเดือนก่อน

    Need More videos on react hooks as your videos are best.

  • @kathikr9360
    @kathikr9360 6 หลายเดือนก่อน +1

    thank you

  • @chommc375
    @chommc375 8 หลายเดือนก่อน +1

    love it
    from vn

  • @BishanTamang-rk5ji
    @BishanTamang-rk5ji 8 หลายเดือนก่อน +4

    Make 2024 java course love from Nepal 💓❤️

    • @user-vq1uq9ul6o
      @user-vq1uq9ul6o 8 หลายเดือนก่อน

      Yes plz make it❤

    • @quvomiddinkamalov3292
      @quvomiddinkamalov3292 4 หลายเดือนก่อน

      There is a Full Java course on his channel

    • @RychAhlberg
      @RychAhlberg 4 หลายเดือนก่อน

      They don’t teach you the word “please” when you learn English in Nepal? Don’t be rude.

  • @ujjwalaggrawal5486
    @ujjwalaggrawal5486 7 หลายเดือนก่อน +1

    Bro,plz make a complete vid on React Js n Node Js,sort of full stack application series.
    Plzzzz🙏🙏🙏

  • @rishabhkedia9304
    @rishabhkedia9304 7 หลายเดือนก่อน +1

    Please make Reactjs projects as well

  • @nguyenanh-vt4jv
    @nguyenanh-vt4jv 6 หลายเดือนก่อน +1

    at 1:22 can any want say me that what did he use to tab both the open tag and close tag of button

  • @elitegaming8565
    @elitegaming8565 8 หลายเดือนก่อน +1

    Hi Again
    Love from India

  • @BLAZIN77KONG
    @BLAZIN77KONG 8 หลายเดือนก่อน +1

    Hello Bro, I love your tutorials but can you make a updated Java Tutorial? Love from India

  • @lucasmikael9199
    @lucasmikael9199 8 หลายเดือนก่อน

    i want to use code which there is an text that can be renamed that is on the left down corner of the screen and there is a bigger one in the center of the screen , when the user renames the text to the video urlit will start to make the user choose an video file from the device and when uploaded in the video it will globally display the video there will be a mechanic for the place of the videos uploading , while a video is currently playing being first to be displayed when another user uploads a video the video will be in 1st place before being displayed and if the currently playing video ends the next one uploaded by the other user will be displayed

    • @lucasmikael9199
      @lucasmikael9199 8 หลายเดือนก่อน

      i need you to fix this code also


      TH-cam Video Player

      body {
      margin: 0;
      overflow: hidden;
      }
      #videoUrlInput {
      position: fixed;
      bottom: 40px;
      left: 40px;
      width: 300px;
      height: 30px;
      padding: 5px;
      font-size: 16px;
      }
      #videoContainer {
      position: fixed;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      width: 80%;
      height: 80%;
      background-color: black;
      overflow: hidden;
      }
      video {
      width: 100%;
      height: 100%;
      }






      let isPlaying = false;
      function setVideoSource() {
      const videoUrlInput = document.getElementById('videoUrlInput');
      const videoPlayer = document.getElementById('videoPlayer');
      // Set the video source directly
      videoPlayer.src = videoUrlInput.value;
      // Play the video if not already playing
      if (!isPlaying) {
      videoPlayer.play();
      isPlaying = true;
      }
      }

  • @Movie-MOVlE
    @Movie-MOVlE 8 หลายเดือนก่อน +1

    Why your videos doesn't show in my Subscription Section???

  • @slhliwwa5403
    @slhliwwa5403 3 หลายเดือนก่อน +1

    what does it mean the component re-render and what's the purpose of it ???

    • @ameybelvalkar8877
      @ameybelvalkar8877 หลายเดือนก่อน +1

      Consider Function Based Components as normal functions in javascript which returns an jsx code, so when the value in the function changes due to local variables that are used with the use state Hook, entire function is called again which causes re-render to display updated value of functions

  • @raitaskeen
    @raitaskeen 8 หลายเดือนก่อน +1

    Bro can you provide a RUST course????

  • @workdaboi-ys5ob
    @workdaboi-ys5ob 8 หลายเดือนก่อน +1

    Dear Bro, much support on your videos. I'm learning web development from your channel, if you would do REACT COMPLETE TUTORIAL that would be really helpful. Thanks

  • @Vincent_12770
    @Vincent_12770 8 หลายเดือนก่อน +1

    chief pleace make golang course or nodejs...

  • @KingOfMadnesss
    @KingOfMadnesss 8 หลายเดือนก่อน

    Day 2 of asking for an SFML full course (After the react course)

  • @Beanbag59
    @Beanbag59 7 หลายเดือนก่อน

    Do u tutor

  • @l213dhanesh3
    @l213dhanesh3 8 หลายเดือนก่อน

    Code bro... How are u man? Angular start padara