Full React Tutorial #17 - Fetching Data with useEffect

แชร์
ฝัง
  • เผยแพร่เมื่อ 31 ม.ค. 2025

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

  • @kolJan-1
    @kolJan-1 3 ปีที่แล้ว +10

    Bro you're a life saver, I am a bootcamp student who almost quit because I can't keep up with react, now here, I am getting hope to continue, I press like and watch all the ad to show my support to your channel, please stay awesome sir, God bless!

  • @amanpreetsinghbawa1600
    @amanpreetsinghbawa1600 3 ปีที่แล้ว +23

    The best part of tutorials is you have them backed by the course files.
    Very well managed.

  • @rafiashan8389
    @rafiashan8389 5 หลายเดือนก่อน +3

    I can't believe someone can explain this well in such a short video. Ninjas were always my favs since childhood.

  • @86Illa
    @86Illa 3 ปีที่แล้ว +46

    Thank you so much for this course! Your way of explaining is extremely clear - I have used React for a while now, but at times things still get confusing. You make everything extremely clear :)

    • @once-upon-a-time-7
      @once-upon-a-time-7 2 ปีที่แล้ว

      i love you :)

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

      @@once-upon-a-time-7 no simping please

    • @freeyourmind7538
      @freeyourmind7538 10 หลายเดือนก่อน

      ​@@equim7363 I love you 💓

  • @CarlosSGonzalezV
    @CarlosSGonzalezV 3 ปีที่แล้ว +3

    Man thanks so much! You won't believe how many days I've been searching how to do this, finally I got to your playlist and I'm gonna watch it from the beginning to properly learn React again.

  • @melancholicmuse
    @melancholicmuse 3 ปีที่แล้ว +3

    This course is my first introduction to React and i'm enjoying the lessons so much

  • @googleaccount7252
    @googleaccount7252 2 ปีที่แล้ว +6

    Tip for those struggling, make sure that you have two terminals running, one for react the other for db. and make sure you .db file is saved.

  • @conan_ft
    @conan_ft 4 ปีที่แล้ว +21

    I love all your tutorials, you explain it all so clear!

    • @NetNinja
      @NetNinja  4 ปีที่แล้ว +4

      Thank you so much! :)

    • @tomaszswiatek4612
      @tomaszswiatek4612 4 ปีที่แล้ว +1

      yep i agree:), and I'm still up to date with this awesome n1 tutorial :)

  • @yangliu3754
    @yangliu3754 3 ปีที่แล้ว +5

    Great solution to deal with the null!
    After the data is fetched and the setBlogs is invoked, React re-renders the whole component, and this is why when the blogs value changes the (blogs && ) part runs again.

  • @aliaksandrhn1
    @aliaksandrhn1 2 ปีที่แล้ว +82

    5:40 You could have easily corrected the error by using an empty array rather than null as an initial state: const [blogs, setBlogs] = useState( [] );

    • @KingstonFortune
      @KingstonFortune 2 ปีที่แล้ว +5

      thanks for this tip! glad I took a glance at the comments and found yours as number 1

    • @pratyushpurohit
      @pratyushpurohit 2 ปีที่แล้ว +28

      He could but his point was to teach us a new concept. Glad he didn't use []

    • @ziaurrahman9529
      @ziaurrahman9529 2 ปีที่แล้ว

      thanks!

    • @seclvded
      @seclvded 2 ปีที่แล้ว +4

      damn, u da mvp. but i also like how he explained it (in case u run to his exact problem)

    • @kavinsanthosh1306
      @kavinsanthosh1306 ปีที่แล้ว

      yeah bro. but why it is not preventing the rendering of blog list. when theoritcally it should?

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

    I can't believe you explain so clear and easily to understand, I'm so glad you exist =). Thank you man

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

      Aha, thanks for the lovely comment :) and for watching!!

  • @gorkemgok9313
    @gorkemgok9313 ปีที่แล้ว

    Man you deserve a prize or something as the best youtube code teacher.

  • @samtakahashi5602
    @samtakahashi5602 2 ปีที่แล้ว

    THIS.
    Was working on an Update/Edit function to finish off this series and was stuck for a few hours wondering why my data properties were returning null...
    Thank you for this fantastic course!

  • @user-ct5oo3do7b
    @user-ct5oo3do7b 3 ปีที่แล้ว +9

    Async version:
    useEffect(() => {
    async function fetchBlogs() {
    let response = await fetch('localhost:8000/blogs');
    response = await response.json();
    setBlogs(response);
    }
    fetchBlogs();
    }, []);

  • @samirprasla1770
    @samirprasla1770 4 ปีที่แล้ว +4

    Thank You so much for your such hard work on all of your tutorial videos, you are very polite and honest teacher !! too the point tutorials all of them are very well explained....!!

    • @NetNinja
      @NetNinja  4 ปีที่แล้ว

      Thank you so much! 😃

  • @ayushdudhani
    @ayushdudhani ปีที่แล้ว +1

    Thanks alot !
    I was using axios while getting data!!
    It was for my hackathon,
    used same way as you shown!!
    it worked!!
    THANKS ALOT MAN !!!!!!

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

      axios is way better and simplier than using fetch() function for me

  • @DigitalMonsters
    @DigitalMonsters 4 ปีที่แล้ว +47

    Set blogs initial state to an empty array if you don't want to have to conditionally render with the double ampersand. Since an empty array is still a valid map object.

    • @karanparmar4318
      @karanparmar4318 4 ปีที่แล้ว +6

      True,
      But I think he did this purposefully to make us understand about conditional rendering.

    • @reactdev7871
      @reactdev7871 4 ปีที่แล้ว +1

      I was just gonna say that good job buddy as I made a real blog with an API here and made a search box on the navbar that can search and filter the blogs so was confused with this null issue so I find out that using empty array fix the issue :D

    • @defaultdefault812
      @defaultdefault812 3 ปีที่แล้ว +1

      Need to be careful that no .length method is evaluated.

    • @sabinoramirez2600
      @sabinoramirez2600 2 ปีที่แล้ว +2

      problem with this approach is the title will display even if the array is empty. This looks ugly in real world application

    • @ericmomoh7927
      @ericmomoh7927 2 ปีที่แล้ว +1

      @@reactdev7871 please can I see the code on how you made the search bar?

  • @youngun550
    @youngun550 2 ปีที่แล้ว +4

    I would absolutely love it if you did a brief tutorial on how to externalise an async await code block. I've managed something close, but I still want to abstract away.. Thanks for the awesome content! Really enjoy your videos, by far the most helpful I've come across :P

    • @parthdesai9751
      @parthdesai9751 ปีที่แล้ว

      at this point, you could probably ask chatgpt

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

    The most useful account ever

  • @RameenFallschirmjager
    @RameenFallschirmjager 4 ปีที่แล้ว

    I know this comment is the most irrelevant comment ever, but I couldn't help myself! I was watching your Vue udemy course and I reached the section that you were teaching how to emit events. I am familiar with this concept, because I learnt it when I was studying game development with godot engine. I got so excited for this "flash of enlightenment!" that I needed to show my gratitude somehow! This incident proves that it's important to expand your knowledge and how knowing some stuff in other areas helps to solidify your skills and knowledge as a whole. And I suggest everybody does it, I mean to try various stuff, it's good for your health!

  • @maskman4821
    @maskman4821 4 ปีที่แล้ว +5

    Thank yoy Shaun for this tutorial, I have learned a valuabke lesson which is conditional template, now I finally understand why and how { blogs && } works, it feels so good to comprehend the reason behind this !!!

  • @henrydinh285
    @henrydinh285 2 ปีที่แล้ว

    OMG! Glad i saw this video. The logical && solved my problem i had for days as im learning react and hooks. Thanks Shaun ❤

  • @CodeRCreatives
    @CodeRCreatives 4 ปีที่แล้ว +3

    You are really very awesome teacher very nicely explained all the concepts of reacts.

  • @Eldalion99999
    @Eldalion99999 4 ปีที่แล้ว +2

    single most useful react video in whole youtube......do you have any idea how long it took me to find all these different pieces of information condensed in this video ??? Especially the 2x .then part....jezus the things I tryed to achieve that. I wish I had this 6 months ago.....

  • @towseefahmed6328
    @towseefahmed6328 4 ปีที่แล้ว +5

    ur simply excellent ... explanation is outstanding... thanks a lot for this excellent content

  • @olorundareagnes934
    @olorundareagnes934 3 ปีที่แล้ว

    I must say that you are a superb teacher.
    Well done Shaun!

  • @andrewpenny1285
    @andrewpenny1285 ปีที่แล้ว

    You solved a problem for me that has been very discouraging. I forgot to set initial stage to null and also forgot about the conditional rendering. I was getting the error about mapping over an undefined array. Thank you again and again!

  • @princearthur5532
    @princearthur5532 2 ปีที่แล้ว +1

    Wow you are great at explanations i have tried several tutorials but this tops it.

    • @NetNinja
      @NetNinja  2 ปีที่แล้ว

      Great to hear :) thanks Prince!

  • @jennifermagpantay7933
    @jennifermagpantay7933 3 ปีที่แล้ว

    Great tutorial!! After a few minutes watching it I found
    out a solution for a bug! Brilliant!

  • @staplepin8099
    @staplepin8099 4 ปีที่แล้ว +4

    Best teacher

  • @madannikalje760
    @madannikalje760 3 ปีที่แล้ว +2

    Thank you so much this helped me alot ngl I was stuck in that error for long time I wasn't able display my fetch data

  • @alexhungerford
    @alexhungerford 3 ปีที่แล้ว

    great summary at 6:39

  • @ScottRocke
    @ScottRocke 3 ปีที่แล้ว +1

    Thank you for the clear and concise video. Definitely helped unblock some brain cells.

  • @eylemgokdemir
    @eylemgokdemir 2 ปีที่แล้ว

    BEST json server tutorial. THANK YOU!

  • @martiananomaly
    @martiananomaly 2 ปีที่แล้ว

    The use of && was pretty smart.

  • @azeezalsafadi901
    @azeezalsafadi901 2 ปีที่แล้ว

    I learned a million things from this lesson
    Thank you The Net Ninja!!

    • @NetNinja
      @NetNinja  2 ปีที่แล้ว

      You're very welcome Azeez! :)

  • @RodRavenpictures
    @RodRavenpictures 9 หลายเดือนก่อน

    The goat. (period)

  • @akashnegi913
    @akashnegi913 4 ปีที่แล้ว +2

    Your Videos are right on Time
    So are we , Thank You :)

  • @Dgrayfit
    @Dgrayfit 3 ปีที่แล้ว

    In regards to the 6:00 minute mark. So the idea with the {blogs && ... } code here is that because we have initially set the state of blogs to be null we will initially get blogs to evaluate as false, so the logical && won't fire since both conditions must be true. However, we 'react' to the new render by updating the state of blogs in the useEffect() hook, which then makes blogs evaluate to true and our component evaluate to true. I think I am following, but if anybody can spot a gap in my understanding please jump in.

    • @andrewpenny1285
      @andrewpenny1285 ปีที่แล้ว

      You are correct, but the conditional rendering wouldn’t be so important if it wasn’t for the map method being called on the data in the other component. Mapping over undefined data will throw an error and the app will fail to load anything at all. Basically, we are waiting until the data has arrived before we start trying to pass it around or render it.

  • @vidmis224
    @vidmis224 3 ปีที่แล้ว +1

    You are life saver mate!!

  • @bobhammell6308
    @bobhammell6308 ปีที่แล้ว

    Very consise tutorials, great for picking up the concepts. Thank you!

  • @varunsritejakatikireddy9616
    @varunsritejakatikireddy9616 3 หลายเดือนก่อน

    Great Video. Helped me a lot. Thanks!

    • @NetNinja
      @NetNinja  3 หลายเดือนก่อน

      Glad to hear it! :)

  • @dineshrout2527
    @dineshrout2527 3 ปีที่แล้ว

    Love the way you teach 🙏

  • @KerishaStewart
    @KerishaStewart ปีที่แล้ว

    Your videos are amazing!

    • @NetNinja
      @NetNinja  ปีที่แล้ว +1

      Thank you so much! :)

  • @billpapas3054
    @billpapas3054 3 ปีที่แล้ว

    What a god explanation and teach!!!!! Adtonishing buddy!! Ty

  • @Rose-93
    @Rose-93 2 ปีที่แล้ว

    Thank you fo such a clear explanation :)

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

    thank you sir! You helped me a lot.

  • @rahulsriram6295
    @rahulsriram6295 4 ปีที่แล้ว +1

    If you take the initial value as Empty array instead of null, it works too

    • @maskman4821
      @maskman4821 4 ปีที่แล้ว

      cool !

    • @KehindeEnirayetan
      @KehindeEnirayetan ปีที่แล้ว

      I used both approach but was unable to see any blog displayed.

  • @khedubaba
    @khedubaba 3 ปีที่แล้ว

    Pure and sweeet knowledge.

  • @AbrahamWilson
    @AbrahamWilson 4 ปีที่แล้ว

    Dude your tutorials are excellent, seriously enjoying the content. Could you please make a course where you show how to make CRUD apps using the MERN stack.

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

    It should be noted that with react version >= 18 in strict mode, useEffect will be called once for mounting, and immediately again to simulate an unmounting and remounting of the component. So that fetch request will be sent twice. If you want to disable that, comment out the tags

  • @mohammadawais163
    @mohammadawais163 2 ปีที่แล้ว

    Excellent Explanation❤

  • @rogeclash2631
    @rogeclash2631 ปีที่แล้ว

    many thanks for this , it is very clear

    • @NetNinja
      @NetNinja  ปีที่แล้ว

      Thanks Roge. Glad to hear that!

  • @Pupu._
    @Pupu._ 4 ปีที่แล้ว +1

    clear explanation as always! :)

  • @monson2048
    @monson2048 ปีที่แล้ว

    Amazing content! Love your explanations!

  • @amjadaliafridi1023
    @amjadaliafridi1023 ปีที่แล้ว

    it has been a superb journey so for

    • @NetNinja
      @NetNinja  ปีที่แล้ว

      Awesome to hear that Amjad!

  • @elora2334
    @elora2334 3 ปีที่แล้ว

    Thank you, its so clear with your explain !

  • @levantinian02
    @levantinian02 11 หลายเดือนก่อน

    Thanks for the series.
    Question here: Why the blogs didn't get set to the value being returned from the fetch? Shouldn't the return statement wait until the fetch function finishes since it uses promises and everything should wait till it finish its work? And like that the value of blogs wouldn't be null. I want explanation to what happened :)

  • @nenadbenke9834
    @nenadbenke9834 ปีที่แล้ว

    It keeps calling get request with useState. I just did it with fetch inside useEffect. By the way Shaun's way of teaching is the best for me.

    • @KehindeEnirayetan
      @KehindeEnirayetan ปีที่แล้ว

      Hello please I used the “empty array” approach and “null” approach but none worked. No blog was displayed on screen. Any hint with this

  • @Ishant56
    @Ishant56 3 ปีที่แล้ว

    Wow amazing Tutorial Thank You ❤️

  • @sirusThu
    @sirusThu 2 ปีที่แล้ว

    Amazing explanation. thanks

  • @x9wozz
    @x9wozz 4 ปีที่แล้ว

    Can't wait for more :D
    Also will you explain why we ended up using hooks instead of class components? I suppose it's because of things like mentioned before useEffect hook and more. Though I'm neither familliar with react class components so I don't know if I'm not wrong here

    • @maskman4821
      @maskman4821 4 ปีที่แล้ว +1

      If you are new to react, just learn hooks, always go with the latest technologies !

    • @x9wozz
      @x9wozz 4 ปีที่แล้ว +1

      @@maskman4821 but the thing is that most companies still use things that were written before hooks update and that's often the case that you have to deal with legacy-ish code. That's why learning class components is relevant for me, since I'm aiming to transfer from just being frontend dev to react dev*.
      *from what I've noticed there's a lot more of corpo work as frontend dev than actual programming as react dev if that makes sense.

  • @Anuvrinda-j
    @Anuvrinda-j ปีที่แล้ว

    Hey! I found this video very late after i stepped into development . I wish i found about this channel earlier. Thank you so much for providing this great information. Also, we set the initial state for the blog data as 'null' . Could we use an empty array for that as well ? That way , i didn't get the error 'cannot read map of null'

  • @Pampaza
    @Pampaza 3 ปีที่แล้ว +1

    Great tutorial, thanks. I have just one question, how do you fetch it and map it inside the same component?

    • @akeymthedream
      @akeymthedream ปีที่แล้ว

      I think you can do so by using props to access blogs and then mapping the props in the BlogList component

  • @teetphum
    @teetphum 3 ปีที่แล้ว

    Thank you so much!! you save my web app

  • @johnsmith-oy9kx
    @johnsmith-oy9kx 4 ปีที่แล้ว +1

    Excuse me if I'm asking too much, please do a 'react native 2021' tutorial in 'net ninja' style, it will help us a lot. I know there are a lot of react native courses out there but we like it in net ninja style - simple, sharp and comprehensive. PLEASE...

  • @GiancarloCarccamo
    @GiancarloCarccamo 2 ปีที่แล้ว

    great video man

  • @anony4142
    @anony4142 ปีที่แล้ว

    Thanks for the explanation, but I have a simple question why we did not use asynchrounous function so we won't render anything till the blogs are returned from the fetch ?

  • @fatihkaya6817
    @fatihkaya6817 4 ปีที่แล้ว +2

    could you show how do we implement fetching data in backend and passing the data via Express routes to frontend? This would be very helpful simple full stack implementation

  • @olgapolskolg1112
    @olgapolskolg1112 3 ปีที่แล้ว

    Thanks a lot, you helped me to solve a problem

  • @sdrplk
    @sdrplk 4 ปีที่แล้ว +1

    Shaun, just curious how you prepare, compile and present videos. your workflow. you seemed to well prepared, I wonder how the hell he does it, maybe a time traveler??. a video on behind the seens?

    • @NetNinja
      @NetNinja  4 ปีที่แล้ว +27

      Haha, I wish I could time travel. I spend just as much time planning (if not more) as I do recording... Course notes, course files, slides etc are all made prior to recording anything :). Maybe one day I'll do a 'day in the life' video and show my methods :)

    • @lasindunuwanga5292
      @lasindunuwanga5292 4 ปีที่แล้ว +2

      @@NetNinja yes please. It will be an inspiration

    • @PythonicPath1
      @PythonicPath1 4 ปีที่แล้ว +1

      @@NetNinja yes that would help a lot

    • @drhastings
      @drhastings 3 ปีที่แล้ว

      @@NetNinja Will highly appreciate that😅

  • @LoveisHell85
    @LoveisHell85 4 ปีที่แล้ว

    Amazing content. Thank you so much.

  • @ai.aspirations
    @ai.aspirations 3 ปีที่แล้ว

    Perfect my friend!

  • @jonaskarl
    @jonaskarl 4 ปีที่แล้ว

    Very good Playlist! Thanks.
    Is there a way, I can read and manipulate the blogs state in multiple components?

  • @LorandPalfalvi
    @LorandPalfalvi 2 ปีที่แล้ว

    Thank you!
    I would have loved it if you would have used async/await instead of then.
    Almost nobody uses .then anymore.

  • @oleksiik4473
    @oleksiik4473 4 ปีที่แล้ว

    Hi, great job, thank you for your work! In this course, in a feature we see Redux?

  • @Se.mu01
    @Se.mu01 4 ปีที่แล้ว

    Just what I needed

  • @nerdiloo9863
    @nerdiloo9863 4 ปีที่แล้ว

    "Maann, you are Metacmucil" 🔥🔥🔥

  • @CrookzArtwork
    @CrookzArtwork 4 ปีที่แล้ว

    So clean

  • @TrueStoryET
    @TrueStoryET 4 ปีที่แล้ว +1

    is this the last video on react? cause I need to learn it asap

    • @HaoTran-hd7io
      @HaoTran-hd7io 4 ปีที่แล้ว +1

      I think it's not the end, btw you can read react document while waiting for his new videos

    • @NetNinja
      @NetNinja  4 ปีที่แล้ว +1

      Hey, there will be 32 videos in total :)

    • @TrueStoryET
      @TrueStoryET 4 ปีที่แล้ว

      @@NetNinja thank you for teaching! *bows to sensei*

  • @NuclearAmouri
    @NuclearAmouri 2 ปีที่แล้ว +1

    5:15 Couldn't we just initialize `blogs` to an empty array?
    const [blogs, setBlogs] = useState([]);

  • @bananabread6758
    @bananabread6758 ปีที่แล้ว

    excellent video

  • @ajaykumarpulletikurthi2558
    @ajaykumarpulletikurthi2558 3 ปีที่แล้ว

    You are the God

  • @drifung
    @drifung 3 ปีที่แล้ว

    thanks for the tutoriel

  • @ForwardTokage
    @ForwardTokage 2 ปีที่แล้ว

    life saver 😭

  • @mdkarim831
    @mdkarim831 4 ปีที่แล้ว

    Thanks a bunch for these tutorials! Do you think you could show how to properly implement google OAuth 2.0 in a reactjs app? I have done an implementation but it looks very incorrect especially my redirect part.

  • @bumpty9830
    @bumpty9830 ปีที่แล้ว

    I got CORS errors trying to follow this. You might think about adding a note, or maybe even a short tutorial video, about dealing with this. I had success after adding a --middlewares flag to the json-server run, pointing to a json file with the following contents:
    module.exports = (req, res, next) => {
    res.header('Access-Control-Allow-Origin','*');
    next();
    }

  • @sheeshaliosama5837
    @sheeshaliosama5837 ปีที่แล้ว +1

    I did the same thing you did but it keeps giving me errors ('blogs.map is not a function') and (Failed to execute 'json' on 'Response': Illegal invocation) can you explain the problem and how to solve it please

  • @ziekaman2450
    @ziekaman2450 3 ปีที่แล้ว

    setBlogs method? Where did you initiate that method?

  • @Doimaixinhtuoi
    @Doimaixinhtuoi 4 ปีที่แล้ว +1

    In stead of initializing the blogs state with null value, is it ok to use an empty array?

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

    thanks for this video

  • @AngryBacteria
    @AngryBacteria 2 ปีที่แล้ว

    I now know how to only display something when the useFetch has the data from the json server. But how would I go about only doing a certain action if the json object is loaded? For example I only want to fill an array once the data is loaded but I dont know how to do it

  • @huntershub3030
    @huntershub3030 2 ปีที่แล้ว

    !!!!!!!!!!!!!!!!!!!THANK YOU!!!!!!!!!!!!!!!!!

  • @RushabhWadkar
    @RushabhWadkar 4 ปีที่แล้ว

    When will this playlist get uploaded with all the videos? I want to watch it fully at one go over the weekend.. rather than wait a single day for each video.. please upload it all.. soon

    • @pieteromt8121
      @pieteromt8121 4 ปีที่แล้ว

      Just come back in two weeks and you have them all. :-)

  • @bartekk6480
    @bartekk6480 2 ปีที่แล้ว

    thanks so much!!!!!!!!!!!!!!!!!!!!!!!!!!!!

  • @SreecharanShroff
    @SreecharanShroff 4 ปีที่แล้ว +1

    Please do a NextJS full tutorial

    • @NetNinja
      @NetNinja  4 ปีที่แล้ว +6

      I'll be doing a next.js tutorial after this one :)

    • @sdrplk
      @sdrplk 4 ปีที่แล้ว +1

      @@NetNinja you must be a mind reader

    • @maskman4821
      @maskman4821 4 ปีที่แล้ว

      that woul be awesome, I have been looking forward to nextjs tutorial !!!

    • @unknownman1
      @unknownman1 4 ปีที่แล้ว +2

      @@NetNinja woahhhhhhhh.

  • @krishnakanth4576
    @krishnakanth4576 3 ปีที่แล้ว

    thanks a lot!

  • @ah_spider7350
    @ah_spider7350 10 หลายเดือนก่อน

    6:35
    in there what if I used tTernary operation?

  • @maxbisceglie1682
    @maxbisceglie1682 4 ปีที่แล้ว

    Shouldn't the component update after blogs is updated without the conditional rendering? I thought the state variables were reactive... I'm a bit confused sorry

  • @Bashir3675
    @Bashir3675 2 ปีที่แล้ว

    As you said it takes some time for the data to be fetched, that is why it is not available initially. But how using && is making the data available ? or is it taking some time until the the data gets fetched? Can somebody explain?