192.168.10.10/:1 Access to fetch at 'http://newsapi.org/v2/top-headlines?country=us&apiKey=myapikey from origin 'http://192.168.10.10:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled. What should I do? Pls Help
Here is my code:
`import React,{useState} from 'react';
import './App.css'
import News from './News.jsx'
const App = () => {
const [news,setNews] = useState([])
const getNews = async () => {
const response = await fetch(`https://newsapi.org/v2/top-headlines?country=us&apiKey=myapikey`,{
})
const data= await response.json();
setNews(data.articles)
console.log(news)
}
return (
<div className='container'>
<section className='container mb-5'>
<h1 className='text-center xs heading'>The Latest News Web Application</h1>
<button type="button" className="btn btn-outline-primary btn-lg " style={{marginLeft:'450px',marginTop:'10px'}} onClick={getNews}>Get The Latest News</button>
</section>
<div className='News'>
{
news.map(info => (
<News
key={info.author}
author={info.author}
title={info.title}
description={info.description}
content={info.content}
urlToImage={info.urlToImage}
url={info.url}
publishedAt={info.publishedAt}
/>
))
}
</div>
</div>
)
}
export default App`