简体   繁体   English

React:React、MVVM 或 Redux 的初学者友好设计模式?

[英]React: Beginner friendly design pattern for React, MVVM or Redux?

I am a beginner of React, plan to start some side projects to advance my skills.我是 React 的初学者,计划开始一些辅助项目来提高我的技能。 Which design pattern is more beginner-friendly to start with, Redux or MVVM?哪种设计模式对初学者更友好,Redux 还是 MVVM? Useful links or tutorials are highly appreciated.非常感谢有用的链接或教程。 Thanks!谢谢!

In my experience, React + Redux is a pretty beginner-friendly and killer combination when it comes to building web-apps.以我的经验,React + Redux 在构建网络应用程序时是一个非常适合初学者和杀手级的组合。

I can highly suggest trying out Redux with the React framework Gatsby.我强烈建议使用 React 框架 Gatsby 尝试 Redux。

Here's how to get started in no time: https://www.freecodecamp.org/news/how-to-get-started-with-gatsby-2-and-redux-ae1c543571ca/以下是如何立即开始: https://www.freecodecamp.org/news/how-to-get-started-with-gatsby-2-and-redux-ae1c543571ca/

Please note that most tutorials for Redux out there show an outdated style of Redux we no longer really recommend to use in new applications.请注意,大多数 Redux 教程都显示了 Redux 的过时样式,我们不再建议在新应用程序中使用。 Best follow the official tutorials at https://redux.js.org/tutorials/index to learn modern Redux.最好按照https://redux.js.org/tutorials/index的官方教程学习现代 Redux。 If you follow anything else, make sure it uses the official redux toolkit and hooks.如果您关注其他任何内容,请确保它使用官方 redux 工具包和挂钩。

In general: if you are following any React tutorial and it spends time on class components, it is probably pretty outdated.一般来说:如果您正在关注任何 React 教程并且它花费时间在 class 组件上,那么它可能已经过时了。 Hooks in function components are around for a few years now and pretty much where the ecosystem has ended up - you will probably only encounter class components in legacy projects. function 组件中的钩子已经存在了几年,并且几乎是生态系统已经结束的地方 - 您可能只会在遗留项目中遇到 class 组件。

Also note, though, that we recommend first learning React and then learning Redux when it is really necessary.不过,还要注意,我们建议先学习 React,然后在真正需要时学习 Redux。 You don't really need any external state management library in the beginning, and you also should probably not try to apply any classical design patterns onto React.一开始你真的不需要任何外部的 state 管理库,你也不应该尝试将任何经典设计模式应用于 React。 React has it's own way of doing things and most design patterns really don't fit it very well. React 有它自己的做事方式,大多数设计模式确实不太适合它。 So... just learn the framework and see how it feels?所以……只要学习一下框架,看看感觉如何? :) :)

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

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