React Basics Ep. 4: React Basics - Calling an API

แชร์
ฝัง
  • เผยแพร่เมื่อ 11 ธ.ค. 2024

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

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

    Just a note: componentDidMount() happens BEFORE the render. If you console.log("life cycle name") in each life cycle and check the console you will see that componentDidMount will happen before the render. It's actually where an API call should go. componentWillMount isn't guaranteed to mount. And why would you want to call an API if the component doesn't mount? Putting it in componentDidMount means the API only gets called IF a render is about to happen.

  • @learnchinese619
    @learnchinese619 7 ปีที่แล้ว

    Thanks for this video. Very useful info. I will check out your other videos as well. I like how you strike a balance between explaining things but not over-explaining them.

  • @girlandhercomputer7204
    @girlandhercomputer7204 5 ปีที่แล้ว

    wow, i really like your explanation and the library u use, quite different from other youtubers, I learned things, Great thanks U earn my sub~

  • @TimothyLeeBanks
    @TimothyLeeBanks 8 ปีที่แล้ว

    thank u very helpful, just what i needed, a simple clean way to get an ajax call. everyone decides to make shit so fuking complicated for no reason, but good looks on bein straight to the point.
    i appreciate u

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

    Man, you're awesome. Thanks for sharing your knowledge!

  • @emekavilla
    @emekavilla 8 ปีที่แล้ว

    Thanks man!! Very informative especially the debugger in dev tools.

  • @laserlock6491
    @laserlock6491 6 ปีที่แล้ว

    I was not able to recreate this example. I believe the api now requires a key as the response to my request was:
    {"Response":"False","Error":"No API key provided."}
    I still learned a lot from this video though.

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

    Thanks mate....which keyboard do you use ?by the way sounds good

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

    this is perfect to what I am trying to learn! Thanks so much!

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

      pro trick: watch movies at Flixzone. Me and my gf have been using them for watching lots of of movies recently.

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

      @Kieran Cain definitely, I've been watching on Flixzone for years myself =)

  • @monkeymagic2385
    @monkeymagic2385 8 ปีที่แล้ว

    I've heard that it's good practice to seperate out the data fetching into a 'container' component - would you recommend this why?

  • @GabrielDelFiaco
    @GabrielDelFiaco 7 ปีที่แล้ว

    How to render the total of numbers and make an pagination ?

  • @ricardoserrao
    @ricardoserrao 7 ปีที่แล้ว

    Great explanation!

  • @felixthetutor1618
    @felixthetutor1618 6 ปีที่แล้ว

    Hello, I am doing everything as indicated on the video. However, when I type the word star I can't see the movies being the returned from the database like you. Why? Please help. Send me a message if you would like for me to send a screenshot of my error. Thanks.

  • @gurnzbot
    @gurnzbot 8 ปีที่แล้ว +9

    Great video. Take er easy on the keyboard ;)

  • @SogMosee
    @SogMosee 7 ปีที่แล้ว

    How do you get your error messages in the console to look like that when using webpack, specifically, how do you get the errors to output the exact line number that the error occurs on? What is your webpack configuration?

    • @justinball3401
      @justinball3401 7 ปีที่แล้ว

      Here's a link to the code we use to generate our webpack config github.com/atomicjolt/atomic-reactor/blob/master/webpack.config.js

    • @SogMosee
      @SogMosee 7 ปีที่แล้ว

      thank you for sharing Justin! Unfortunately, I am having trouble identifying the direct code that enables this functionality. Is it simply a matter of including the "friendly-errors-webpack-plugin" to my config, or are the HtmlBuilderPlugin and FlowCompilerPlugin necessary as well?

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

      You are correct. Just add the friendly-errors-webpack-plugin.

  • @scorpi0000
    @scorpi0000 8 ปีที่แล้ว

    following this video, i got this on my console
    Each child in an array or iterator should have a unique key prop.
    how i can add the key on that?

    • @naioti
      @naioti 8 ปีที่แล้ว

      Just like Mah Lu showed, just make sure the key is always unique

  • @utkavi33
    @utkavi33 7 ปีที่แล้ว

    I was trying to authorize my react app using the var URL object but I get the error 401. any clue how to get rid of the error?

    • @AtomicJolt
      @AtomicJolt  7 ปีที่แล้ว

      Check to make sure the url is spelled correctly. I'm pretty sure IMDB doesn't have any authentication in place that would block your request.

  • @RanjeetKumar-mf8ml
    @RanjeetKumar-mf8ml 6 ปีที่แล้ว

    What do if the cors is not enabled? And how one can enable while creating his or her own API?

    • @yevheniiherasymchuk
      @yevheniiherasymchuk 6 ปีที่แล้ว

      It's a question to backend, not React app.
      In general there are already many libraries to allow CORS. What language do you user on server?

  • @jasonsolorio3975
    @jasonsolorio3975 6 ปีที่แล้ว

    thank you so much for the help!!

  • @benhawy
    @benhawy 7 ปีที่แล้ว

    I have a project where I have to use the Wiki API and I am so determined to use React for it. IT's just the CORS issue is driving me nuts! I wanna develop on my local machine and I can't find a video/article out there addressing how to do that using React. I am using the creat-react-app tool too.
    Can you make a video that shows how to get around that issue?

    • @AtomicJolt
      @AtomicJolt  7 ปีที่แล้ว

      The CORS configuration is on the server side so Wiki API would be the one to add it. Alternatively, you can setup a proxy and call the API through the proxy. I'll see if we can walk through creating a proxy.

  • @DivjotSingh
    @DivjotSingh 9 ปีที่แล้ว

    Thanks for the video!
    BTW why loadash map over ES5 map ?

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

      +Divjot Singh It's partially out of habit. We use lodash quite a bit and so I revert to using it quite often. A couple of years ago we were burned by a browser specific bug - the browser didn't support map so I started using only underscore/lodash. That's less of an issue these days. With lodash you to get the added benefit of being able to chain other methods when you need it i.e. compact, sort, etc.

  • @grigorischaram3216
    @grigorischaram3216 7 ปีที่แล้ว

    which your sublime theme?

  • @abrvpto
    @abrvpto 7 ปีที่แล้ว

    Awesome tutorial. Unfortunately they have changed their policy and now you can only access the API if you pay at least $1,00/month so you can have an API key.

    • @AtomicJolt
      @AtomicJolt  7 ปีที่แล้ว

      That's unfortunate. The process is still the same, but we'll have to find a different service to work with for future tutorials. Thanks for letting us know!

  • @soufianechalouh7454
    @soufianechalouh7454 6 ปีที่แล้ว

    easy on the keyboard, poor keyboard :D Thank you

  • @ErBahugunaGoyal
    @ErBahugunaGoyal 7 ปีที่แล้ว

    awesome :)

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

    Great tutorial, but you missed one vital piece of code :
    "Star Trek as better than Star Wars".

  • @pavanvyas2879
    @pavanvyas2879 7 ปีที่แล้ว

    great

  • @DevSage
    @DevSage 7 ปีที่แล้ว

    I'm new to React. Why didn't you just say this.state.movies.map ((movie)=>.....?

    • @AtomicJolt
      @AtomicJolt  7 ปีที่แล้ว

      You can do that. We use lodash all the time so I just used it out of habit.

  • @VadirajS
    @VadirajS 7 ปีที่แล้ว

    Great explanation, but your voice is not consistent please work on that