How To Fix CORS Error In React Js? (2022) | Solved!!

Поделиться
HTML-код
  • Опубликовано: 27 июл 2022
  • In this video, we will see how to solve CORS error in React Js. This is going to be the best solution of this problem in 2022. I hope you find this video helpful and enjoy!!
    🎬Watch Next-
    ▶React Search Filter Tutorial
    • React Search Filter wi...
    ▶The Ultimate React Developer Roadmap
    • The Ultimate React Dev...
    ▶Become a Pro MERN Stack Developer
    • Become a Pro MERN Stac...
    ▶Stop Wasting Your Time!
    • Stop Wasting Your Time...
    💖Be A Patron (Support On Monthly Basis)-
    ☑ / codewithmasood
    Get Source Code & Other Perks!
    🔰Connect With Me:
    ▶Facebook - / official.codewithmasood
    ▶Instagram - / codewithmasood.official
    ▶Blog - / codewithmasood
    ▶Pinterest - / codewithmasood
    📙Must Read Books That Will Transform Your Thinking-
    ▶Psychology of Money: amzn.to/3jqvhyp
    ▶How to Win Friends and Influence People: amzn.to/3GifLh7
    ▶Ego is the Enemy: amzn.to/3GmZA26
    ▶Power of Habit: amzn.to/3FRszcW
    ▶Cracking the Coding Interview: amzn.to/3C2bYBW
    ▶Introduction to Algorithms: amzn.to/3jzkt1f
    ▶Cryptography and network security: amzn.to/3WQrol3
    #CodeWithMasood
    #Programming
    #coding
    DISCLAIMER: Some of the links in the description above are affiliate links, which means that if you click on one of the links and make a purchase, I will receive a small commission. This helps support the channel and allows me to continue to make videos like this. Thank you for your support!

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

  • @achaleebotoma3748
    @achaleebotoma3748 Год назад +5

    Wow. Thanks because you didn't just solve the problem but you explained while solving it👌

  • @its_prashhh
    @its_prashhh 10 месяцев назад +1

    Thankyou buddy, it helps me a lot !!

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

    Thank you. solved my issue in less than 2 minutes.

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

    Found this helpful. Thanks

  • @MitjaCH
    @MitjaCH 5 месяцев назад +3

    Thank you bro I love you. I was being forced making an React.js Web application and If I wouldn't have fixed this in 2 hours me and my entire family would've been executed. THANK YOU SO MUCH!

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

    Thanks you helped me ❤

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

    thank you! very good!

  • @niteshgupta8462
    @niteshgupta8462 4 месяца назад +1

    Thanks a lot🎉

  • @dddanielsr
    @dddanielsr Год назад +8

    The title is misleading, U didn't fix this on the client's side

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

      Please watch the complete video first! You can connect me on insta as well

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

    Helpful video ❤️

  • @Harshavardhan-xy9he
    @Harshavardhan-xy9he 5 месяцев назад

    Hello bro how i can write code if i want to use multiple origins

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

    Thank you ❤

  • @devil-sz5kp
    @devil-sz5kp День назад

    Will this work after hosting?

  • @takudzwambereko1046
    @takudzwambereko1046 5 месяцев назад +1

    Thanks bro, you saved my day

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

    I think it is not recommended to install cors

  • @jccintr
    @jccintr 8 месяцев назад +1

    The problem was not in react but in node server.

  • @kairattobokelov3239
    @kairattobokelov3239 Год назад +4

    hahhahhahh, solving problem in 'CLIENT SIDE'

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

    I’m getting an error where app.use is saying that .use is not a usable funcyion

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

      app.use is just a command that tells express that we are using a middleware, the actual thing lies inside the app.use function which is cors. Please follow the tutorial with concentration.

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

    Nice but I'm not using a JS backend

  • @divyam-hx3ie
    @divyam-hx3ie 7 месяцев назад

    thank you brooooooooooo!!!!!😭😭😭😭😭😭😭😭😭😭😭😭😭😭😭😭😭😭😭

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

    but when we have the build it still giving the CORS error.

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

      So before build you have to update your cors origin to build host respective!

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

    How to fix the error in client-side ?
    (Require is not defined )

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

      You need to use imports instead of require

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

      Hey are you able to solve this issue at client side ?

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

      @@engineersexploring8543 I changed my host, i used Github host server to deploy my rest api

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

    but there is no index.js file in Vite in react js

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

      He is fixing the problem in node js

  • @kelechinwuba-onyejeana1549
    @kelechinwuba-onyejeana1549 Год назад

    posts error 'app' is not defined no-undef. I am using axios

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

      That is not the Cors issue I guess!

    • @kelechinwuba-onyejeana1549
      @kelechinwuba-onyejeana1549 Год назад +1

      @@CodeWithMasood how do i define app since i am not using express?

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

      @@kelechinwuba-onyejeana1549 Hey are you able to solve this issue at client side ?

    • @kelechinwuba-onyejeana1549
      @kelechinwuba-onyejeana1549 Год назад

      @@engineersexploring8543 I used axios api and added to the headers -'Access-Control-Allow-Origin' : '*',
      'Access-Control-Allow-Methods':'GET,PUT,POST,DELETE,PATCH,OPTIONS',

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

    This was a server side fix which is easy to solve. Title is misleading unfortunately. This is not a React fix. Title makes it sound like you resolved it from client.

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

      On client side you don't need cors!

    • @sheldonsays9922
      @sheldonsays9922 Год назад +4

      @@CodeWithMasood You get cors error in browser, so on client side when connecting to some server. Question is how to solve that in scenarios where you can't amend server. The emphasis in title is "In React Js". React is client side. Title makes it sound like you are solving it in React. When in actual fact you solved it server side which is simple to solve. Not saying your solution is wrong. The title is misleading. This is not a client side fix.

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

    Bhai you are devta

  • @lokeshawasthi6640
    @lokeshawasthi6640 8 месяцев назад +1

    SAME ERROR SHOW HO RAHI HAI

    • @CodeWithMasood
      @CodeWithMasood  8 месяцев назад +1

      Please watch the video again and follow along. I hope you will fix the issue

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

    Better the title would be "In Node.js" instead of React.js

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

    Thanks alot bro🥲🥲🥲🥺