Call API in React Js | How to send data from frontend to backend react

Поделиться
HTML-код
  • Опубликовано: 7 фев 2022
  • In this tutorial, I show you how to call API in react js. If you want to send or receive some data from the backend and you don't know how to send data from frontend to backend react, this quick video can help you how to achieve this.
    You can download the project source code from here: pezeshkzade.com/blog/source-c...
    Fetch docs: developer.mozilla.org/en-US/d...
    Hope you enjoy it.
    Consider subscribing...
    Have a great day.
  • НаукаНаука

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

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

    You can download the project source code from here: pezeshkzade.com/blog/source-code/

  • @fazliddinfayziev-qg1vg
    @fazliddinfayziev-qg1vg Год назад

    Bro your good mentor. Explanation was so good. Thank you bro✊✊✊

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

    Thank you, excellent guide by API with clear explanation for every step

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

    Thanks, that was really helpful.

  • @0xredpill
    @0xredpill 9 дней назад

    Bro Masoud you are a star like you explained this like you are explaining it to a baby.

  • @matt112fly
    @matt112fly 2 года назад +7

    hey man great tutorial! i'm trying to send a word from search bar to backend into a function... which fetches data from API and updates it into the backend server..how can i do something like that? 1. search 2. use the search to fetch data from API 3. update the backend server with new data 4. display new data to front end

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

    very clear explanation

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

    سلام ،من یه با react یه برنامه نوشتم الان میخوام با axios وصل کنم به backend ولی من چیزی از backend نمیدونم فقط میخوام بزارم روی رزومه ام که بدونن کار با axios رو بلدم ، میخوام یه سری دیتا مثل Id و taskName رو از backend بگیرم باید چی کار کنم ؟

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

    Great very helpful for me

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

    how can I make my local data in a localhost data please?

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

    nice you solved my doubt

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

    When you setAuthors in line 35 after creating a author, why do you use an => instead of just setAuthors([…prev, resultInJson])

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

      because when our state depends on old value of state, we use arrow function...in this case, we had to pick other 4 users as well, so we used the spread operator to get them as well and then added the new user.

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

    Hi, tanks for the video.. i have a problem in my code.
    Uncaught (in promise) SyntaxError: Unexpected end of input (at Main.jsx:17:1)
    That line contains:
    const resultJson = await result.json()

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

    good video

  • @josepdevillaret
    @josepdevillaret 18 дней назад

    Masound can i contact you privately?

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

    👏🏼

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

    Whem posting data to server I'm receiving "has been blocked by CORS policy" error, how can I solve this ? thanks so much, very good tutorial

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

      Because your server domain address and your client address(localhost) doesn't match.

    • @nseals100
      @nseals100 Год назад +6

      You need to add the dependency cors to connect the backend to the front-end. Add npm install cors command to your back-end json package in the terminal. And you most definitely want your backend port different from your front-end port.