在React中不处理可重复使用的组件
我正在努力遵循重复组件的反应哲学。
我有三个屏幕(Screen1,Screen2)用作我的应用程序沿不同页面的选项卡(Page1,page2),但是每个页面都不相同,它们在标签,按钮等文本中略有不同他们有。并且有一个组件,一个面板,可以在特定页面的所有屏幕中共享。
我应该为每个页面创建每个屏幕作为不同的组件吗?导致4个屏幕组件(第1页的两个,第2页)?如果是,我是否应该在与常规组件文件夹不同的文件夹中定义它们?因为它们不会重复使用。还是我应该创建一个可重复使用的组件并传递给它应该显示为JSON的数据?
I'm struggling with following the React philosophy of reusing components.
I have three screens (Screen1, Screen2) that are used as tabs in different pages along my application (Page1, Page2), but these screens are not the same for each page, they differ slightly in the text of labels, buttons, etc that they have. And there is a component, a panel, that is shared among all the screens of a certain page.
Should I create each screen as a different component for each page? Resulting in 4 screen components (two for Page1 and two for Page2)? If yes, should I define them in a different folder than the regular components folder? Because they wouldn't be reusable. Or should I create a reusable component and pass to it the data it should display as json for e.g.?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
“我应该将其作为组成部分提取吗?”的问题。太情境了,无法回答。因此,这取决于:
这些是您需要回答的问题。
The question of "Should I extract this as a Component?" is too situational to answer. So it depends on:
These are the questions you need to answer.