Using Fetch API in React to populate NewsItems | Complete React Course in Hindi #27

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

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

  • @CodeWithHarry
    @CodeWithHarry  3 года назад +26

    Playlist access kar lena: ruclips.net/p/PLu0W_9lII9agx66oZnT6IyhcMIbUMNMdt
    If you are on Instagram, you can follow me there for more updates on courses & other stuff: instagram.com/codewithharry

    • @adarshjaiswal2312
      @adarshjaiswal2312 2 года назад +1

      hi harry
      where we can get full code

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

      @@adarshjaiswal2312 plz batao harry bhai

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

      Haris Bhai CompTIA A+ CompTIA security+ CEH pr networking pr videos banaden

  • @shashwatagrawal8412
    @shashwatagrawal8412 3 года назад +29

    Maza aagya bhai... Can't tell how blessed I feel to have discovered your course and also your channel. :)

  • @SinmbfLost
    @SinmbfLost Год назад +14

    If you want to make all the cards to equal height then follow this:
    In the div with className="card" , add a class called "h-100".
    Now every card should be of same height but the buttons are not aligned properly due to the difference in content of the different cards. To fix this, in the div with className="card-body", add classes "d-flex flex-column". Then finally, in the read more button add a class "mt-auto".
    This should make every card equal height and make them look better. If any problems, feel free to ask :)

    • @ummi7292
      @ummi7292 7 месяцев назад +1

      Hi ..could you plz let me know why the fetch api was used in componentDidMount() and not in the constructor(). I understand it means the fetch API happens after rendering but my question is "why"? Why can't it happen at the very outset ?

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

      @@ummi7292 Because you cannot make a constructor async in JavaScript.
      if we use fetch() API without async and await then it will asign value to data variable as a pending promise (it will assign varaible first because of Asynchronous nature of JS )

  • @maneetkaur4214
    @maneetkaur4214 2 года назад +30

    When I was following the code by Harry Bhai there got an error when fetching the data from the API. this is what I did to resolve the error (I guess this would work for you ) :
    async componentDidMount(){
    try{
    const res = await fetch(url);
    const data = await res.json();
    this.setState({
    articles: data.articles
    });
    }
    catch(e) {
    console.log("something is not working");
    }
    }
    PS. You can use axios too

    • @abhishek_rathod
      @abhishek_rathod 2 года назад +1

      Thank you brother it helps.

    • @drowning-Monkey
      @drowning-Monkey 2 года назад +2

      Thanks brother i was struggling with this error for 2-3 hours now it's working.... 👍

    • @harshitsz8144
      @harshitsz8144 2 года назад +1

      thanks, it worked

    • @nitishsrivastava571
      @nitishsrivastava571 2 года назад +1

      Thanks bro Its very helpfulful for me.

    • @TheSachinkk
      @TheSachinkk 2 года назад +1

      Working...Thank a lot

  • @faizshaikh5092
    @faizshaikh5092 2 года назад +16

    Hello, Harry Bhai! You can use below code for adding three dots to title and description of
    news:
    style={{maxWidth: '100%',
    display: '-webkit-box',
    WebkitBoxOrient: 'vertical',
    WebkitLineClamp: 2,
    overflow: 'hidden',
    textOverflow: 'ellipsis'}}
    Thank you! Love from solapur

    • @kamalpurohit7158
      @kamalpurohit7158 2 года назад +1

      are bro direct jake text-truncate class use kro na khel khatam

    • @kamalpurohit7158
      @kamalpurohit7158 2 года назад +1

      bootstrap class h text-truncate u can see

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

      www.youtube.com/@advanceduitechniques516

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

      @@kamalpurohit7158



      but i am not getting 3 dots at end

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

      @@thecosmetrohub2737 use text-truncate inside tags of NewsItem component where you defined title and description and it will work

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

    Anand aa rha hai Hary bhai! Excellent you are

  • @nothingmuch9346
    @nothingmuch9346 3 года назад +2

    Class 9 me hun phir bhi Harry bhai ka ds algo smjh gya itna accha explained hain

  • @AmitKumar-xx7zj
    @AmitKumar-xx7zj Год назад +2

    Thank you Harry bhai for such an awesome course

  • @CodeWhy
    @CodeWhy 3 года назад +1

    @codewithharry you are my favourite youtuber. Love you bro☺️☺️☺️☺️

  • @anantdhiman4189
    @anantdhiman4189 3 года назад +23

    i recently start following this course and i am loving it, thank you so much
    while learning "fetch" i was getting this error "TypeError: Cannot read properties of undefined (reading 'map')"
    From reactjs Docs - this is what i found and works for me, may be it helps other too
    fetch(url).then((res) => res.json())
    .then((json) => {
    this.setState({
    articles: json.articles,
    loading: false
    });
    })

    • @rushikeshsaraf6219
      @rushikeshsaraf6219 3 года назад +4

      bro after one hour finally i got solution

    • @rushikeshsaraf6219
      @rushikeshsaraf6219 3 года назад +12

      Update ur constructor like this :
      constructor() {
      super();
      this.state = {
      articles : [],
      loading : false
      }
      }

    • @anantdhiman4189
      @anantdhiman4189 3 года назад +1

      Thank you @rushikesh
      I did realised, I didn’t use await :)

    • @anjanisharma9509
      @anjanisharma9509 3 года назад

      @@anantdhiman4189 yes

    • @fantasycube2482
      @fantasycube2482 2 года назад

      @@rushikeshsaraf6219 thank you so much you make life life ! other wise i am looking length and array

  • @itsmytechnology9285
    @itsmytechnology9285 3 года назад +2

    Harry Bhai OP!!!! 🔥😊

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

    Aanand aa raha h Harry bhaii♥

  • @samuelfrank1369
    @samuelfrank1369 Месяц назад +2

    Thanks a lot #HarryBhai

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

    harry bhai 7:47 hum element.title && element.title.slice(); and same for description also bhi use kr skte hai nah maine wahi kiya tha aur usse thik hogya tha.....

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

    Your explanation is awsome you are my inspiration

  • @tejaskumar4470
    @tejaskumar4470 3 года назад +2

    Wow!!!! 🔥🔥 Harry Bhai 😀

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

    Done with #27 Thank YOU!!
    🥳

  • @ArunKumar-jg8gx
    @ArunKumar-jg8gx Год назад

    East or west Harry Bhaiya Best 🔥😍

  • @MensAttitude
    @MensAttitude 7 месяцев назад +3

    If render is called before the componentdidmount, then how articles is being displayed on the page. Because page will be rendered first, and after rendering the page component did mount will be called where we are fetching the data from API?

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

      I think that's why he used async await function which stops all other function and fetch data and then render so using async function it will wait for fetching and then render page

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

      I implemented the same and I’m facing the same issue

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

    Anand Aa Rha Hai

  • @Amal-qh3uu
    @Amal-qh3uu 3 года назад +1

    Harry bhai on fire !!

  • @AsyncGaming
    @AsyncGaming 3 года назад

    Bhai aaj toh aapne mauj kardi ek ke baad ek videos♥️♥️

  • @brijeshtelecombusiness
    @brijeshtelecombusiness 3 года назад +1

    Sir Multi Recharge Software development ke baare me bhi kuchh bataye

  • @ASShaikh-x5r
    @ASShaikh-x5r 3 месяца назад

    Maza aa gya bhaai....

  • @HariomSingh-ei4fb
    @HariomSingh-ei4fb 2 года назад +1

    This video series is very very helpful and interesting
    Thanks alot Harry bhaiii♥️

    • @rahulmaurya2558
      @rahulmaurya2558 2 года назад

      I'm totally getting blank page after writing all the codes and in the console its showing the 20 objects I don't know where is the error?

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

    Amazing work #harryBhai

  • @SlickStatus
    @SlickStatus 2 года назад

    Bahot Sahi 💥

  • @dipusah9795
    @dipusah9795 2 года назад

    koi dikkat wali bat nahi hai harry vai

  • @ajayarya1193
    @ajayarya1193 Год назад +12

    Hello, buddy, if you're also get stuck with same problem I had been, just paste it
    async componentDidMount() {
    fetch("url").then((response) => response.json())
    .then((data) => {
    this.setState({
    articles: data.articles
    });
    });
    },
    If anyone can explain me why the old one did not work please help me out.

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

      you are life saver

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

      Dil se sukriya bhai❤

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

      thank you i was stuck here from 2 days

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

      Hii, i am still stuck with not getting any news from api show on the browser.
      I can see thtat the api is working as I can see the result in console tab, but not on the web page.
      No error is displaying as well

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

      Hii, i am still stuck with not getting any news from api show on the browser.
      I can see thtat the api is working as I can see the result in console tab, but not on the web page.
      No error is displaying as well

  • @abhayvis
    @abhayvis 3 года назад +4

    Harry is on fire 🔥

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

      it is no harm pay no attention to it

  • @rajatchaurasia3578
    @rajatchaurasia3578 3 года назад +1

    Fully Sunday gride 🔥🔥🔥

  • @allaeibgaming2164
    @allaeibgaming2164 3 года назад +1

    Please make course on machine learning

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

    can you please make a video on Yelp API...

  • @PrabinManandhar-y5l
    @PrabinManandhar-y5l 7 месяцев назад +1

    hey harry one question, first the constructor is called then render is called and only then componentdidmount is called which brings the data. if render is called before componentdidmount, then how is the fetched data rendered and shown to our page

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

      I think because he used asyn await so the execution of another function stopped and first componentdidmount called and then render

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

      componentdidmount function re-renders the page immediatly after changing the state..thus first constructor then render then componentdidmount then render again..

  • @shi-nee7966
    @shi-nee7966 3 года назад +1

    For the algorithem. Altho i bought a course on udemy before this course started but i know harry bhai's the best. So im liking and commenting on every video for the algo.

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

    if anybody having error for undefined:state
    Simply add this to componentDidMount :
    .then(response => response.json())
    .then(data => this.setState({ articles: data, loading: false }));

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

      Bro please can you send the full code pls i am facing this error from last two days

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

      @@rahulvishwakarma9640 send me your number

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

      same question...can you paste your code here

  • @allaeibgaming2164
    @allaeibgaming2164 3 года назад +1

    Please continue your machine learning course

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

    harry bhai koi effective way nahi hai kya API se data fetch karne ke liye?
    ....becauce everytime we click next ...it again request the api........jisse apne request waste ho rahe hai...... there should be a way jisse app ek sath hi sab page load kar lo ..then after usse page mai seprate kar lo........

  • @gopal12455
    @gopal12455 2 года назад +1

    this tutorial is usefull

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

    Constructor
    Render
    Component did mount
    That’s the reason it’s not displaying in browser and if you map in component did mount and you can see the output.

  • @sachinverma3925
    @sachinverma3925 2 года назад

    full majaaa aaa rha Harry bhai❤❤❤❤❤✌✌

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

    Thank you ❤️

  • @ManojKumar-ul1qp
    @ManojKumar-ul1qp Год назад

    Harry bhai sahi mein maza agaya. You are the best teacher and I like your voice very much ❤️

  • @psychoticgamer6853
    @psychoticgamer6853 3 года назад +1

    Angaar... 🔥🚀

  • @dakshkumar3690
    @dakshkumar3690 3 года назад

    you are a legend bro your explanation is awsome you are my inspiration

  • @aryan7069_
    @aryan7069_ 3 года назад

    logic ne harry bhai ka dimaag lelia

  • @piyushbora4763
    @piyushbora4763 2 года назад +1

    Hello Harry Bhai!
    Why didn't all the articles get displayed in this page only?

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

    Yess mza aaya ❤❤

  • @SakshamVedi
    @SakshamVedi 3 года назад

    harry bhauuu u are star

  • @ashishvispute2715
    @ashishvispute2715 Год назад +13

    for those whose componentDidMount is not working i found this syntax and it worked for me
    here is my News.Js file
    import React, { Component } from 'react'
    import NeswItem from './NewsItem'
    export class News extends Component {
    constructor(){
    super();
    this.state={
    data : null,
    loading : false
    }
    }
    componentDidMount(){
    let url = //your url
    fetch(url).then((res)=>{
    res.json().then((result)=>{
    console.log(result.articles)
    this.setState({data:result.articles})
    })
    })
    }
    render() {
    return (




    Top Headlines

    {this.state.data ?
    this.state.data.map((element)=>



    )
    : null
    }




    )
    }
    }
    export default News

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

    maza aagaya bhai

  • @lavanyashivu6125
    @lavanyashivu6125 3 года назад

    Awesome series

  • @AMITKUMAR-np7el
    @AMITKUMAR-np7el 2 года назад +4

    i recently start following this course and i am loving it, thank you so much
    while learning "fetch" i was getting this error "TypeError: Cannot read properties of undefined (reading 'map')"
    I have used below code in constructor and its working fine....
    constructor() {
    super();
    console.log("This is constructor")
    this.state = {
    articles: [],
    loading: false
    }
    }

    • @abhishekbiranje4533
      @abhishekbiranje4533 2 года назад +1

      update your code instead using this.setState({articles:parsedData.articles}) you can use this.setState(this.articles=parsedData.articles) and also cannot remove the articles array that you already initialize in the first place.

    • @anishgoyal4424
      @anishgoyal4424 2 года назад +1

      @@abhishekbiranje4533 Hey dude this is not working , it shows a "," missing error

    • @abhishekbiranje4533
      @abhishekbiranje4533 2 года назад +1

      ​@@anishgoyal4424 sorry my mistake use = in setState(this.articles = parsedData.articles),this will work

    • @anishgoyal4424
      @anishgoyal4424 2 года назад

      @@abhishekbiranje4533 thanks

    • @rahulmaurya2558
      @rahulmaurya2558 2 года назад

      @@abhishekbiranje4533 you are telling use = in setState but where ? i got confused

  • @Armaan-yv1se
    @Armaan-yv1se 5 месяцев назад +1

    My headlines are not getting populated on browser and there's no issue in compilation and it's not showing any error.. How to resolve it???

  • @rittwickbhabak7348
    @rittwickbhabak7348 2 года назад

    This react js couse is very helpful. Awesome teaching style.

    • @FarhanAhmad-ll5fn
      @FarhanAhmad-ll5fn 2 года назад

      fetch is not working please help me

    • @rittwickbhabak7348
      @rittwickbhabak7348 2 года назад +1

      @@FarhanAhmad-ll5fn there may a lot of reasons, it is impossible to track it without seeing the actual code, you may paste the errors here, we can see it.
      One possible reason may by, you are not using localhost:3000, instead you are using 198.162.xx.xx ip address, using ip address will not work, instead open the localhost link,
      other possible reason may be the wrong apikey, or a expired api key.

    • @FarhanAhmad-ll5fn
      @FarhanAhmad-ll5fn 2 года назад

      can you give me your mail so i send you pictures of output and code

  • @mohituniyal7
    @mohituniyal7 3 года назад +2

    I would comment in every video till you don't reply. I am really thankful to you. I didn't have cs in 12th but learned programming c and CPP from your videos and still learning. Moreover, I got a confidence boost. Once again thank you for your efforts.

  • @aymandin4912
    @aymandin4912 3 года назад

    My future job is depending on you harry bhai... Thanks a lot!

    • @FarhanAhmad-ll5fn
      @FarhanAhmad-ll5fn 2 года назад

      fetch is not working please help me

    • @sujitcodes
      @sujitcodes 2 года назад

      @@FarhanAhmad-ll5fn same problem, not able to update the articles data using useState()

  • @princejain2851
    @princejain2851 3 года назад

    bhai angular pr bhi ek full tutorial bhi bnao.usme kaafi problem aati h

  • @Victor-ev3vu
    @Victor-ev3vu 3 года назад +1

    3 videos under 2 hours

  • @psychoticgamer6853
    @psychoticgamer6853 3 года назад +1

    Make a tutorial on how to integrate react with django

  • @lavanyashivu6125
    @lavanyashivu6125 3 года назад +1

    Pls do make Redux series also 🙏

  • @mughalyt2304
    @mughalyt2304 3 года назад

    Sir jo react ka course hai aap ka 1.5hour k vedio hai
    Wo or yhe react course same hain ya yhe different hai

  • @lavanyabisht5984
    @lavanyabisht5984 7 месяцев назад +1

    I am having a problem during console log after running constructor render cdn again render is running why if you know the problem help out

  • @kingsukrudra2997
    @kingsukrudra2997 3 года назад

    Thank you via

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

    till here done

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

    Harry Bhai, Your courses are great and certainly the best on YT.
    I would love to see a svelte course from you.

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

    data are not coming in card which we used to populate the news items please help me

  • @hasan_0.0.7
    @hasan_0.0.7 Год назад

    #HarryBhai, Harry Bhai, big fan. But I have a question, what is promise? I think I have missed this part. Can you please tell me in which video have you discussed about it?

  • @abhisekchowdhury8584
    @abhisekchowdhury8584 3 года назад +1

    Harri please show some examples --- how to use POST parameters with json body in Fetch APIs ?

  • @rajbannasa7662
    @rajbannasa7662 3 года назад

    Thank you so much sir ❤️

  • @getknowledgebite3413
    @getknowledgebite3413 2 года назад +1

    DidMount ko thoro explain bhi kar dete kya hua iss code m sbb upper se gya sir

  • @Gaurav_Nahata
    @Gaurav_Nahata 3 года назад +1

    brother you are doing a gr8 work . can u please teach me how to create an array in java

    • @supratim08
      @supratim08 3 года назад +1

      int [] arr={1,2,3,4,5}
      another way is by mentioning the size-->
      int [] arr= new int[4];
      arr[0]=1;
      arr[1]=2;
      ..
      and do check the java playlist for detail.

    • @ShubhamVerma-hw4uj
      @ShubhamVerma-hw4uj 3 года назад

      bhai java ka poora course bna rkha h bhai ne

    • @Gaurav_Nahata
      @Gaurav_Nahata 3 года назад

      @@supratim08 tnx

  • @ikbalbodila4148
    @ikbalbodila4148 3 года назад

    Hello Harry Bhai,
    I am in diploma, I want to buy a laptop, which processor is better for diploma and Degree of Information technology ?
    intel i-3 or intel i-5 ?
    ryzen-3 or ryzen-5 ?
    Please reply me....

  • @hometvfirestick
    @hometvfirestick 3 года назад

    thanks

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

    Incase If your articles is fetching and showing in console but not rendering in page, use this.state.articles in map function

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

      facing same issue.. can you tell breifly

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

      @@sheikhmuzamil7218
      async componentDidMount(){
      const res = await fetch(url);
      const data = await res.json();
      //Here I used this.setstate we must use this.articles.setstate//
      this.articles.setState({ articles: data.articles
      });
      }

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

      @@narasimha6470 The browser is saying that this.articles.setState is not a function

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

      @@sehajdeepsingh7427 may be spelling Mistake of setState

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

      @@narasimha6470 is this correct written in error code? this.articles.setState is not a function

  • @Skm-mq1sw
    @Skm-mq1sw 3 года назад

    Harry Bhaiya categories wise news fetch kijiye

    • @Skm-mq1sw
      @Skm-mq1sw 3 года назад

      Means that sports news ko sport category me

  • @santy-vlogs
    @santy-vlogs Год назад +1

    whoever getting error like this "TypeError: Cannot read properties of undefined (reading 'map')" please try this solution , change fetch(url) to
    fetch(url).then((res) => res.json())
    .then((json) => {
    this.setState({
    articles: json.articles,
    loading: false
    });
    });
    it should work

    • @AnuragKumar-zx7ew
      @AnuragKumar-zx7ew Год назад

      bro can you please send your code , as I am struggling from 3 days, but till now I am getting same error

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

      thank you

  • @VANSHDUTTPATHAK
    @VANSHDUTTPATHAK 3 года назад

    make a full course on Kali Linux

  • @babunapati8630
    @babunapati8630 2 года назад +1

    while using fetch api ive been detected with this error messgae on console page " Uncaught (in promise) SyntaxError: Unexpected token '

  • @kumawatnaresh3451
    @kumawatnaresh3451 3 года назад

    Componentdidmount hi naam rakhan hai ya kuch or sir iss function ka 4:17

  • @sahiljain2524
    @sahiljain2524 2 года назад

    Kya isko Git pe deploy kar sakte he kya?

  • @framed5893
    @framed5893 Год назад +20

    If someone is getting error "Cannot read properties of undefined (reading 'map')" then use this this.state.articles && this.state.articles.map((element) ....

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

      Can you explain me

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

      @@avadhut0007 It checks whether the array is NULL or not, if it is null then (i.e it will check this.state.articles is NULL or not ), if it is null then it will not run the code. We have to do this because if it is null then .map function will throw error.

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

      ​@@framed5893sir ,I tried this but card item is not showing

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

      Check if you added () after json like data.json();

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

      After 2h of struggle I found out I have a spelling mistake, (articles -> articels) 🌚

  • @RakeshBitling
    @RakeshBitling 3 года назад

    Big Fan... Please make videos on AWS serverless

    • @FarhanAhmad-ll5fn
      @FarhanAhmad-ll5fn 2 года назад

      fetch is not working please help me

    • @RakeshBitling
      @RakeshBitling 2 года назад

      @@FarhanAhmad-ll5fn can you pls paste error which u got

    • @FarhanAhmad-ll5fn
      @FarhanAhmad-ll5fn 2 года назад

      @@RakeshBitling constructor() {
      super();
      this.state = {
      articles: [],
      loading: false,
      }
      }
      componentDidMount() {
      fetch(url)
      .then((res) => res.json())
      .then((json) => {
      this.setState({
      articles: json,
      loading: false,
      });
      })
      }

    • @RakeshBitling
      @RakeshBitling 2 года назад

      @@FarhanAhmad-ll5fn : Console Error

    • @FarhanAhmad-ll5fn
      @FarhanAhmad-ll5fn 2 года назад

      @@RakeshBitling send me your code bro

  • @AbhinavSingh-uw6hh
    @AbhinavSingh-uw6hh Год назад +1

    I have a doubt? Why we are changing articles in componentDidMount() and not in constructor() ?

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

      Hey could you help me why fetch is not working?

    • @AbhinavSingh-uw6hh
      @AbhinavSingh-uw6hh Год назад

      @@rupalsaxena9837 yeah sure. send me the code

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

      @@AbhinavSingh-uw6hh import react, { Component } from "react";
      import NewsSite from "./NewsSite";
      export default class News extends Component {
      constructor() {
      super();
      this.state = { articles: [], loading: false };
      }
      async componentDidMount() {
      let url =
      "newsapi.org/v2/top-headlines?country=in&apiKey=7c7a544807b344a8be4cf266f97ca5ca";
      let data = await fetch(url);
      let parsedata = await data.json();
      console.log(parsedata);
      this.setState({ articles: parsedata.articles });
      }
      render() {
      return (

      NewsMonekey


      {this.articles.map((element) => {
      console.log(element.description);
      return (



      );
      })}



      );
      }
      }

  • @harshsingh7713
    @harshsingh7713 3 года назад +1

    Bhaiya mera JEE Ka paper khtm hogya h Mai coding sikhna chahta hu pr mujhe kuch pta nhi h kha se Start kru please give me suggestions 🙏

  • @manitgupta7518
    @manitgupta7518 3 года назад

    love the video sir

  • @AnuragKumar-zx7ew
    @AnuragKumar-zx7ew Год назад

    Friends, if your data is not fetched using API , then you can change your default browser from Chrome to Microsoft edge, this may fetch data, as I was struggling for 3days, and when I change the default browser it suddenly loded all the news

  • @factor5902
    @factor5902 3 года назад +2

    Consistency × 100😌

  • @rishibethi2722
    @rishibethi2722 10 месяцев назад

    What to do if the image is not NULL and its "404 Image Not Found" , what if case should i write to tackle it.....ANY IDEAS ARE ACCEPTED.

  • @shiveshsantapta1745
    @shiveshsantapta1745 17 дней назад

    componentDidMount me this.setState karne k baad mere console me to error hi nhi aa raha slice wala, fir bhi mere app me news update nahi ho raha API se

  • @abhinavshukla5628
    @abhinavshukla5628 2 года назад

    maza aa gaya

  • @adityanawale2634
    @adityanawale2634 2 года назад +1

    Is there any alternative of apis that can be used for deployment part

  • @SlickStatus
    @SlickStatus 2 года назад

    Maza Aaya🤗

  • @charchitdahiya986
    @charchitdahiya986 3 года назад

    Sir around how many videos will be there in the course.

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

    Is there a way to filter news without an imageurl. Like to ignore, if the article doesnt have an image url. And show only does having a image url. Please help.

  • @magicscoder9957
    @magicscoder9957 3 года назад

    sir aap mic kon sa use karte hain

  • @lavanyashivu6125
    @lavanyashivu6125 3 года назад

    Hi pls do make Angular series with crud operations and jwt authentication and pls build a complete MEAN and MERN app

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

    Error : When i click on next button it show me blank page error ( Cannot read properties of undefined(reading 'map')....... Help please 🙏

    • @ManjotSingh-sf5qn
      @ManjotSingh-sf5qn Год назад +1

      Hey I'm facing the same problem did you found the solution yet?

  • @ratneshsiddha88
    @ratneshsiddha88 2 года назад

    mazaaaaaa aagayaaaaa

  • @mahnoorali7354
    @mahnoorali7354 2 года назад

    maza arha hai :)