Reputation: 23
I have a problem, the steam api returns content as html code even though my headers are set to "application/json" as well as the formatting is correct in the url parameters. I've accepted that the link is correct, and Steam just returns html code in the "contents" property. I've sent the length to 300 because I want to return a brief description, and I feel like 300 is a length. As you can see here,
inside appnews.newsitems.contents
that it's all html. I don't know what's going to be new inside the code. so it's very well possible that the string that is returned is something like <a href=\"https://www.modiph...
in the middle of html code. Is there any way to solve with without some insane crazy crazy regex?
Upvotes: 0
Views: 30
Reputation: 1893
You can make use of dangerouslySetInnerHTML
function to set the content of react element to JSX.
From the docs.
function createMarkup() {
return {__html: 'First · Second'};
}
function MyComponent() {
return <div dangerouslySetInnerHTML={createMarkup()} />;
}
Further reading: https://reactjs.org/docs/dom-elements.html
Upvotes: 0