PositiveGuy PositiveGuy - 11 months ago 73
React JSX Question

Returning RSS from React Component

I'm not sure how to resolve this. I get syntax errors in WebStorm when I try to return the first line.

const Feed = Component({
render() {
return (
<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<pubDate>Tues, 23 Aug 2016 10:00:00 CDT</pubDate>

export default Feed

For something React doesn't like the syntax
<?xml version="1.0" encoding="utf-8"?>
because it doesn't recognize what

Answer Source

Yes, React doesn't recognize xml. So, you need to convert your xml to string and put it under <pre> tag to preserve the indents.

Working fiddle: https://jsfiddle.net/Pranesh456/qt2bp9oe/3/