Q:

CORS in React.js

I am new to this concept of CORS and I'm working on a project in React-Redux.  I need to communicate to a 3rd party API which can't be done through AJAX.  Can anyone explain that which library can I use in React that supports CORS?  And why is it better than others? 

A:

As it is written here:

The Cross-Origin Resource Sharing standard works by adding new HTTP headers that allow servers to describe the set of origins that are permitted to read that information using a web browser.   Additionally, for HTTP request methods that can cause side-effects on user data (in particular, for HTTP methods other than GET, or for POST usage with certain MIME types), the specification mandates that browsers "preflight" the request, soliciting supported methods from the server with an HTTP OPTIONS request method, and then, upon "approval" from the server, sending the actual request with the actual HTTP request method.   Servers can also notify clients whether "credentials" (including Cookies and HTTP Authentication data) should be sent with requests. 
Subsequent sections discuss scenarios, as well as a breakdown of the HTTP headers used. 

You should set CORS headers on the server side.  If you don't have access to API code, you can create a proxy server for that, which will proxy requests to API and send back a response with CORS headers.  Or you can set proxy server on the same domain and no CORS would be required.