如何转换 html 模板以做出反应? [英] How to convert a html template to react?
问题描述
我从 themeforest 购买了一个 HTML 管理模板 (https://themeforest.net/item/limitless-responsive-web-application-kit/13080328?s_rank=1).
I have purchased an HTML admin template from themeforest (https://themeforest.net/item/limitless-responsive-web-application-kit/13080328?s_rank=1).
我正在构建一个 MERN 堆栈站点,想知道将这个 HTML 模板转换为 React 站点的最佳方法是什么.将模板分解为组件、手动添加路由以及将 HTML 转换为 JSX 等似乎是一项繁琐的任务.
I am building a MERN stack site, and wondering what would be the best way to convert this HTML template to a react site. Breaking down the template to components, adding routes manually, and converting HTML to JSX etc seems to be a tedious task.
问题出现是因为在 themeforest 中,最流行的管理模板是为 jQuery/HTML 世界构建的,而不是为全栈 JS 世界构建的.例如,我上面链接的主题有大约 7000 次下载.这些模板在购买时会给你一大堆 HTML 和 CSS,如果我们必须用这些来构建一个 React 站点,那么手动将 HTML 转换为 JSX,并将其分解为组件,是一个费力的过程.想知道是否有更好的方法来解决这个问题.
The question arises because in themeforest, the most popular admin templates were built for a jQuery / HTML world, not for a full stack JS world. For example, the theme that I've linked above has ~7000 downloads. These templates upon purchase give you a whole bunch of HTML and CSS, and if we have to build a react site out of these, then manually converting the HTML to JSX, and breaking it down to componenets, is a laborious process. Wondering if there's a better approach to solving this problem.
推荐答案
您可以使用 html-to-react-components
更好的方法是将您的 html 转换为 jsx 并在您的 react-component 中使用.您可以将 html 转换为 jsx 此处.
A better approach would be converted your html to jsx and use in your react-component. You can converted your html to jsx here.
这篇关于如何转换 html 模板以做出反应?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!