从 React Component 中移除渲染 xml 的 "text/html"
Removing "text/html" for rendered xml from React Component
我正在尝试创建一个 rss 提要。现在唯一的问题是当我尝试验证它时,我需要删除 "text/html" 才能正常工作。不确定如何在此处使用我的 React 组件执行此操作:
const Feed = Component({
render() {
return (
<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Test</title>
<link>test</link>
<description>test</description>
<item>
<title>test</title>
<link>test</link>
<guid>test</guid>
<pubDate>Tues, 23 Aug 2016 10:00:00 CDT</pubDate>
<description>test</description>
</item>
</channel>
</rss>
);
}
})
export default Feed
当我通过 Chrome 开发工具查看源代码时,这就是我所看到的,请注意文档类型是 html,而不是 xml:
然后当您将其与任何其他 rss 提要(例如 egghead.io 进行比较时,它们的外观如下:
https://groups.google.com/forum/#!msg/reactjs/jHjrma95bn8
This isn't currently possible. We've done some thinking about how to make that easier, but right now we have 2 places where we keep track of what type of nodes we support (hopefully just 1 place in the future). The first is the JSX transform which hardcodes the list of tags it supports. The second is what is exposed off of React.DOM.*. If you want to fork and extend, that's one option. We're focused on HTML/SVG at the moment, but I would definitely be interested in some way to make all of these injectible and share the list of supported tags.
https://github.com/facebook/react/issues/2278
No, sorry. React DOM is primarily designed for HTML.
我正在尝试创建一个 rss 提要。现在唯一的问题是当我尝试验证它时,我需要删除 "text/html" 才能正常工作。不确定如何在此处使用我的 React 组件执行此操作:
const Feed = Component({
render() {
return (
<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Test</title>
<link>test</link>
<description>test</description>
<item>
<title>test</title>
<link>test</link>
<guid>test</guid>
<pubDate>Tues, 23 Aug 2016 10:00:00 CDT</pubDate>
<description>test</description>
</item>
</channel>
</rss>
);
}
})
export default Feed
当我通过 Chrome 开发工具查看源代码时,这就是我所看到的,请注意文档类型是 html,而不是 xml:
然后当您将其与任何其他 rss 提要(例如 egghead.io 进行比较时,它们的外观如下:
https://groups.google.com/forum/#!msg/reactjs/jHjrma95bn8
This isn't currently possible. We've done some thinking about how to make that easier, but right now we have 2 places where we keep track of what type of nodes we support (hopefully just 1 place in the future). The first is the JSX transform which hardcodes the list of tags it supports. The second is what is exposed off of React.DOM.*. If you want to fork and extend, that's one option. We're focused on HTML/SVG at the moment, but I would definitely be interested in some way to make all of these injectible and share the list of supported tags.
https://github.com/facebook/react/issues/2278
No, sorry. React DOM is primarily designed for HTML.