html2jsx.js
Pure-JS HTML 到 Jsx 解析器也适用于 webworker。
由于来自 React 的使用 DOM(或 Node.js 中的 jsdom)来解析 HTML,因此它不能用于 webworkers。 html2jsx.js使用纯 javascript html 解析器而不是 dom。
用法
使用以下命令从 NPM 安装它:
$ npm install html2jsx.js
然后简单地使用以下方法将 html 解析为 Jsx:
var html2jsx = require ( 'html2jsx.js' ) ;
html2jsx ( '<h1>Hello World</h1>' , function ( err , jsx ) {
// jsx == 'React.createElement("h1", null, [ "Hello W
评论0
最新资源