React useEffect() hook introduction 🌟

Поделиться
HTML-код
  • Опубликовано: 29 сен 2024

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

  • @BroCodez
    @BroCodez  8 месяцев назад +17

    import React, {useState, useEffect} from "react";
    function MyComponent() {
    const [width, setWidth] = useState(window.innerWidth);
    const [height, setHeight] = useState(window.innerHeight);
    useEffect(() => {
    window.addEventListener("resize", handleResize);
    console.log("EVENT LISTENER ADDED");
    return () => {
    window.removeEventListener("resize", handleResize);
    console.log("EVENT LISTENER REMOVED");
    }
    }, []);
    useEffect(() => {
    document.title = `Size: ${width} x ${height}`;
    }, [width, height]);
    function handleResize(){
    setWidth(window.innerWidth);
    setHeight(window.innerHeight);
    }
    return (
    Window Width: {width}px
    Window Height: {height}px
    );
    }
    export default MyComponent;

    • @rumanhasan27
      @rumanhasan27 8 месяцев назад +1

    • @MO-vr1mw
      @MO-vr1mw 8 месяцев назад +2

      Can you do Laravel please

  • @arcaneacademia
    @arcaneacademia 5 месяцев назад

    You explain things in a simple and straightforward way.

  • @elitegaming8565
    @elitegaming8565 8 месяцев назад +11

    first, Subsciber from 2 years
    Your Javascript and Python Course is The Best
    Love from India ❤❤❤❤

  • @Build33_Studio
    @Build33_Studio 8 месяцев назад +12

    Bro code pls reply to me i love your work❤❤❤🎉🎉🎉

  • @akkun_25
    @akkun_25 8 месяцев назад +6

    I appreciate you so much bro
    helping us out and taking from your time to teach us coding for free
    and gathering money for kids from your videos
    all that and doing that in a fun way for viewers
    W man
    W to your parents

  • @milleniummoses
    @milleniummoses 2 месяца назад +2

    This is my fourth tutorial on this subject ad neth first one I really grasped. Thank you for your time.

  • @AIZEN155
    @AIZEN155 8 месяцев назад +2

    Fu*k logic mathematique , code bro is the best

  • @Vincent_12770
    @Vincent_12770 8 месяцев назад +2

    After reacjs series could you please introduce nodejs or even golang series.... mostly for microservices

  • @bperseid
    @bperseid 6 дней назад

    only video that ı understood useEffect thanks man more videos please never leave us :)

  • @KingOfMadnesss
    @KingOfMadnesss 8 месяцев назад +2

    You should do a course on SFML (A C++ library)

  • @DeveloperLinux-c3m
    @DeveloperLinux-c3m 28 дней назад

    if i use multiple useState will it affect the performance of the web app, Will it affect the time complexity

  • @Albert_Hall
    @Albert_Hall 5 месяцев назад +1

    Very interesting and easy absorbable narration 🎉
    Express: (i) => { Sincere gratitude }

  • @منالبوخالفة
    @منالبوخالفة 2 месяца назад

    does this happen only in react js part of code ? i mean the millions of added listeners .. or it happens in normal js file too ?

  • @hawkar7kurdish440
    @hawkar7kurdish440 3 месяца назад

    what is Side Effect? please someone explain briefly

  • @dasdisdus774
    @dasdisdus774 3 месяца назад +3

    This is the only tutorial (especially useEffect) that I can easily understand than others. Thank you so much Bra Code 🙏

  • @syedmajid3202
    @syedmajid3202 13 дней назад

    thanks a lot bro, very helpful!

  • @Niyaz_karma
    @Niyaz_karma 8 месяцев назад +1

    Where would you learn to code if you started over❤❤

  • @NoTimeWaste1
    @NoTimeWaste1 2 месяца назад

    1:51 This is one of the reason why I came here

  • @otabekmadaminov-z2i
    @otabekmadaminov-z2i 8 дней назад

    thank you bro

  • @mk-vg1mx
    @mk-vg1mx Месяц назад

  • @zahersankari7342
    @zahersankari7342 Месяц назад

    you're a legend!

  • @alan_ars
    @alan_ars 27 дней назад

    You saved my homework!! Your explanation is very clear!! Keep your awesome work!! Thank you!!

  • @andromilk2634
    @andromilk2634 7 месяцев назад

    By the way, wouldn't using document.title = ... directly in the component be equivalent to useEffect(() =­> {document.title = ...}) ? In both cases, they are executed after each rerender?

  • @FrostyBlue1712
    @FrostyBlue1712 8 месяцев назад +1

    Hey Bro, Noice vid

  • @andromilk2634
    @andromilk2634 7 месяцев назад

    The only thing which I'm not sure of following is when does exactly a component unmount? Is this something which you manually have to do? Since you were able to change the title of your window by listening to the event, then I assume it never unmounted? (In other words, unmounting is done manually by you?) thanks

  • @bostongreen1629
    @bostongreen1629 3 месяца назад

    Exceptional in the way you teach. Any chance to have the codes of the examples provided?

  • @codegenesis2130
    @codegenesis2130 8 месяцев назад

    Hi bro thank you so much for this.
    Can you please make a detailed react course instead of individual video about topics? Please make a video on next js also.

  • @Pywyoyuyp
    @Pywyoyuyp 3 месяца назад

    This tutorial was on point. Thx! Now I am ready for a more complex examples!

  • @houdariyad4889
    @houdariyad4889 8 месяцев назад

    Our Bro is the best as always !Appreciate ur effort ! Don't know what to do without ur videos 💓 Lots of Love from Morocco 🌷🌷

  • @martinemmerson2809
    @martinemmerson2809 8 месяцев назад

    Hi Bro, love this course on React 👍👍. Hope you can keep going into more advanced levels. 👍👍

  • @BishanTamang-rk5ji
    @BishanTamang-rk5ji 8 месяцев назад

    Make java 2024 plz....Big fan love from Nepal

  • @LazizbekTurayev-bs8by
    @LazizbekTurayev-bs8by 5 месяцев назад

    thank you bro code you have helped alot to me

  • @durgfestivalvibes
    @durgfestivalvibes 3 месяца назад

    great video bro!!

  • @hananfadah
    @hananfadah 8 месяцев назад

    The best introduction! Thank you! 😃

  • @rishabhkedia9304
    @rishabhkedia9304 8 месяцев назад

    Please make Reactjs projects as well

  • @kathikr9360
    @kathikr9360 5 месяцев назад

    thanks for the amazing work brother

  • @rifatmunna
    @rifatmunna 8 месяцев назад

    can you make redux video?

  • @MagnusAnand
    @MagnusAnand 8 месяцев назад

    Have you tried htmx ??

  • @MO-vr1mw
    @MO-vr1mw 8 месяцев назад

    Can you do Laravel please

  • @suwanthadarshana8495
    @suwanthadarshana8495 8 месяцев назад

    Can you do spring boot series

  • @minkhant4167
    @minkhant4167 6 месяцев назад

    thank you
    you are the best

  • @KBHASKAR-
    @KBHASKAR- 4 месяца назад

    Thanks

  • @warlordff2395
    @warlordff2395 8 месяцев назад

    69th like🤪

  • @hola_officia
    @hola_officia 7 месяцев назад

    Thank you 😊

  • @marybenish9716
    @marybenish9716 8 месяцев назад

    Amazing

  • @ruslangilyazov7733
    @ruslangilyazov7733 7 месяцев назад

    I appreciate you so much