html-to-react-components:将HTML页面转换为React组件

时间:2024-02-24 10:42:38
【文件属性】:

文件名称:html-to-react-components:将HTML页面转换为React组件

文件大小:1.79MB

文件格式:ZIP

更新时间:2024-02-24 10:42:38

react html jsx html-to-jsx html-to-react

将HTML的带注释的部分作为单独的模块提取到React组件中。 通过导入子组件并用它们替换适当HTML片段来保留HTML的结构。 结果,您将准备好渲染整个组件树。 尝试 内容 什么时候使用 该实用程序旨在使React开发人员摆脱将HTML转换为组件的繁琐任务。 想象一下,您刚从设计师那里得到了一堆HTML。 您要做的第一件事是将HTML分解为React组件。 这很无聊,应该自动化! 安装 $ npm i -g html-to-react-components 用法 具有data-component属性HTML元素将转换为单独的React组件。 该属性的值是React组件的名称。 另外使用public:前缀指定应将哪些HTML属性作为React道具public: 。 < input public:type =" text " id =" input " data-component =" Input " /> // at usage place < Input type = "text" / > ; // ----^^^^^^^^^^^ // in component's mo


【文件预览】:
html-to-react-components-master
----.travis.yml(77B)
----example()
--------index.js(157B)
--------index.html(296B)
----package.json(1KB)
----.github()
--------FUNDING.yml(84B)
----test()
--------test.js(2KB)
--------fail.html(171B)
--------basic.html(787B)
--------__snapshots__()
----dist()
--------html2react.js(532KB)
----webpack.browser.js(585B)
----.npmignore(61B)
----sample.gif(1.54MB)
----LICENSE.md(1KB)
----.gitignore(159B)
----webpack.config.js(540B)
----CHANGELOG.md(3KB)
----logo.png(20KB)
----lib()
--------processor.js(2KB)
--------index.js(379B)
--------component.js(4KB)
--------writer.js(1KB)
--------module.js(3KB)
--------format.js(386B)
--------code.js(245B)
--------jsx.js(2KB)
--------html2jsx.js(20KB)
--------cli.js(2KB)
----README.md(6KB)
----yarn.lock(225KB)
----.editorconfig(241B)

网友评论