Я использую следующий код для преобразования RSS-канала в файл JSON:
import React from "react";
import Button from '@material-ui/core/Button';
import Feed from 'rss-to-json'
const App = () => {
const getFeed = () => {
Feed.load('https://www.reddit.com/.rss', function(err, rss){
console.log(rss);
});
}
return(
<Button
onClick = {() => getFeed()}
variant="outlined">
Submit
</Button>
)
}
export default App;
Но я получаю следующую ошибку в cosole:
Access to fetch at 'https://www.reddit.com/.rss' from origin 'http://localhost: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.
Я не уверен, как подойти к этой ошибке.