Reactjs Youtube数据API、React和CORS

Reactjs Youtube数据API、React和CORS,reactjs,youtube,youtube-data-api,Reactjs,Youtube,Youtube Data Api,我在试图从Youtube数据Api请求数据时遇到了cors错误。我正在使用React,并尝试了我能找到的每一个演练,它们都以这样或那样的方式结束。我尝试的最新方法是: 在my index.html文件中: <script src="https://apis.google.com/js/api.js" type="text/javascript"></script> 我是从Youtube Api网站上得到的,我得到的错误是:

我在试图从Youtube数据Api请求数据时遇到了cors错误。我正在使用React,并尝试了我能找到的每一个演练,它们都以这样或那样的方式结束。我尝试的最新方法是:

在my index.html文件中:

    <script src="https://apis.google.com/js/api.js" type="text/javascript"></script>
我是从Youtube Api网站上得到的,我得到的错误是:

Uncaught TypeError: Cannot read property 'videos' of undefined

Failed to execute 'postMessage' on 'DOMWindow': The target origin provided 
('https://www.youtube.com') does not match the recipient window's origin 
('http://localhost:3000').
如果我在没有gapi的情况下发送请求,我将收到一个cors错误的响应。 Plz帮助我尝试了许多潜在的解决方案,但我不知所措

Uncaught TypeError: Cannot read property 'videos' of undefined

Failed to execute 'postMessage' on 'DOMWindow': The target origin provided 
('https://www.youtube.com') does not match the recipient window's origin 
('http://localhost:3000').