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

Поделиться
HTML-код
  • Опубликовано: 13 сен 2024
  • Call APIs from your React.js component using Superagent.
    Code: github.com/ato....

Комментарии • 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.

  • @vadimnovozhilov2973
    @vadimnovozhilov2973 8 лет назад +1

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

  • @TimothyLeeBanks
    @TimothyLeeBanks 7 лет назад

    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

  • @girlandhercomputer7204
    @girlandhercomputer7204 4 года назад

    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~

  • @emekavilla
    @emekavilla 7 лет назад

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

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

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

  • @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.

  • @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 =)

  • @gurnzbot
    @gurnzbot 8 лет назад +9

    Great video. Take er easy on the keyboard ;)

  • @ricardoserrao
    @ricardoserrao 7 лет назад

    Great explanation!

  • @monkeymagic2385
    @monkeymagic2385 7 лет назад

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

  • @jasonsolorio3975
    @jasonsolorio3975 6 лет назад

    thank you so much for the help!!

  • @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.

  • @DivjotSingh
    @DivjotSingh 8 лет назад

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

    • @AtomicJolt
      @AtomicJolt  8 лет назад +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.

  • @GabrielDelFiaco
    @GabrielDelFiaco 6 лет назад

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

  • @soufianechalouh7454
    @soufianechalouh7454 6 лет назад

    easy on the keyboard, poor keyboard :D Thank you

  • @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.

  • @ErBahugunaGoyal
    @ErBahugunaGoyal 6 лет назад

    awesome :)

  • @pavanvyas2879
    @pavanvyas2879 7 лет назад

    great

  • @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!

  • @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.

  • @SogMosee
    @SogMosee 6 лет назад

    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 6 лет назад

      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 6 лет назад

      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 6 лет назад +1

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

  • @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?

  • @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 7 лет назад

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

  • @grigorischaram3216
    @grigorischaram3216 6 лет назад

    which your sublime theme?

  • @ibuprofen303
    @ibuprofen303 7 лет назад +3

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

  • @DevSage
    @DevSage 6 лет назад

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

    • @AtomicJolt
      @AtomicJolt  6 лет назад

      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