Loading Data from Behance API in React Component

后端 未结 1 1314
再見小時候
再見小時候 2021-01-26 20:25

I am trying to load Behance project data via their API. Whether its localhost or prod, I am getting the following error --

Fetch API cannot load XXX. Response to prefli

相关标签:
1条回答
  • 2021-01-26 21:16

    This seems to have do less with React and more with Behance. What you are getting is a CORS error as you probably figured out. The short explanation is that CORS is a security measure put in on the browser so that websites cannot request other websites from the browser to appear to be the second website. It is a safety measure in place to protect from some phishing attacks.

    CORS can be disabled by the server (in this case, Behance) but they decide not to, for legitimate reasons.

    Behance would probably allow you to make the request you are trying to make from a server instead. Once you do that, you will need to get the information from your server to your React application, and you will be good to go!

    0 讨论(0)
提交回复
热议问题