简体   繁体   English

我应该如何以及应该如何打开我的 html 页面来反应组件?

[英]How and should I turn my html page to react components?

Trying to make a react app using pre made sources.尝试使用预制资源制作 React 应用程序。 I have a fully functional web page made in vanila js.我有一个用 vanila js 制作的功能齐全的 web 页面。 Is the best approach (or maybe the only one) to turn the html page into multiple react components and just delete the html page or should I maybe find a way to just implement react code into html?将 html 页面转换为多个反应组件并删除 html 页面的最佳方法(或者可能是唯一的方法)是,还是我应该找到一种方法将反应代码实现为 ZFC35FDC70D5FC69D2639883A822EZ53EZ 页面?

Why write 5 times the same button when you can write it once and import it the rest 4 times?既然可以写一次并导入rest 4次,为什么还要写5次同一个按钮? This assures a unified look on your site and that any minor change you make will be reflected in all the proper places.这样可以确保您的网站具有统一的外观,并且您所做的任何微小更改都将反映在所有适当的位置。

Consider a testimonial slider.考虑一个证明 slider。 You want this in your home page and in your about page.您希望在您的主页和关于页面中使用它。 Why have the need to update it in two places?为什么需要在两个地方更新它?

If you are going the React way I will suggest to go all the way.如果您采用 React 方式,我会一直建议您使用 go。 Componetize your site, see the true power of React.使您的网站更具竞争力,了解 React 的真正威力。 Maybe its an overkill for your site (every component appears once -doubt-) but if this is the case you will start learning a really powerful tool with a simple example and the progressively get better.也许它对您的网站来说是一种过度杀伤(每个组件都出现一次-怀疑-),但如果是这种情况,您将通过一个简单的示例开始学习一个非常强大的工具,并且逐渐变得更好。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM