创建react应用程序
This article was created in partnership with Manning Publications. Thank you for supporting the partners who make SitePoint possible.
本文是与Manning Publications合作创建的。 感谢您支持使SitePoint成为可能的合作伙伴。
You’ve heard of the principle of “survival of the fittest”, and you know that it’s especially true in web development. Your users expect split-second performance and bug-free interfaces — and if you can’t deliver them, you can be sure they’ll go straight to a competitor who can. But when it comes to survival, it’s important to remember the full principal of evolution: the best way to thrive is to be adaptable to change.
您已经听说过“适者生存”的原则,并且您知道在Web开发中尤其如此。 您的用户期望瞬间的性能和无错误的界面-如果您无法交付它们,则可以确保他们会直接与有能力的竞争对手竞争。 但是,在生存方面,重要的是要记住进化的全部原理:最好的成长方法是适应变化 。
That’s where reactive programming comes in. Reactive applications are created to be adaptable to their environments by design. Right from the start, you’re building something made to react to load, react to failure, and react to your users. Whatever being deployed to production throws at your application, reactive programming will mean it can handle it.
这就是React式编程的用武之地。React式应用程序的创建旨在通过设计使其适应其环境。 从一开始,您就在构建对负载做出React,对失败做出React以及对用户做出React的产品。 无论将什么部署到生产上都投入到您的应用程序中,响应式编程都意味着它可以处理它。
How does reactive programming achieve this? It embeds sound programming principles into your application right from the very beginning.
React式编程如何实现这一目标? 它从一开始就将合理的编程原理嵌入到您的应用程序中。
In reactive programming, data is pushed, not pulled. Rather than making requests of data that may or may not be available, client recipients await the arrival of messages with instructions only when data is ready. The designs of sender and recipient aren’t affected by how you propagate your messages, so you can design your system in isolation without needing to worry about how messages are transmitted. This also means that data recipients are only consuming resources when they’re active, rather than bogging down your application with requests for unavailable data.
在React式编程中,数据是推入而不是拉出。 客户接收者不是在请求可能可用或可能不可用的数据,而是仅在数据准备好后才等待带有指令的消息到达。 发件人和收件人的设计不受邮件传播方式的影响,因此您可以独立设计系统,而不必担心邮件的传输方式。 这也意味着数据接收者仅在活动时才消耗资源,而不会因对不可用数据的请求而使应用程序陷入困境。
Reactive applications are designed to elastically scale up or scale down, based on the amount of workload they have to deal with. A reactive system can both increase or decrease the resources it gives to its inputs, working without bottlenecks or contention points to more easily shard components and then distribute resources among them. Not only does this save you money on unused computing power, but even more importantly, it means that your application can easily service spikes in user activity.
响应式应用程序设计为根据必须处理的工作量来弹性地放大或缩小。 一个React性系统可以增加或减少它提供给输入的资源,而没有瓶颈或争用点,可以更容易地分片组件,然后在它们之间分配资源。 这不仅可以为您节省未使用的计算能力,而且更重要的是,这意味着您的应用程序可以轻松地应对用户活动高峰。
Reactive applications must react to their users, and to their users’ behavior. It’s essential that the system responds in a timely manner, not only for improved user experience, but so that problems can be quickly identified and (hopefully!) solved. With rapid response times and a consistent quality of service, you’ll find that your application has simpler error handling as well as much greater user confidence.
React性应用程序必须对他们的用户及其用户的行为做出React。 系统必须及时做出响应,这不仅是为了改善用户体验,而且是能够快速发现问题(并希望解决)的关键。 凭借快速的响应时间和一致的服务质量,您将发现您的应用程序具有更简单的错误处理以及更大的用户信心。
Reactive applications need to respond, adapt, and be flexible in the face of failure. Because a system can fail at any time, reactive applications are designed to boost resiliency through distribution. If there’s a single point of failure, it’s just that — singular. The rest of your reactive application keeps running, because it’s been built to work without relying on any one part.
响应性应用程序需要在出现故障时做出响应,适应并保持灵活性。 由于系统随时可能发生故障,因此响应式应用程序旨在通过分发来提高弹性。 如果只有一个故障点,那就是-单数。 您的React式应用程序的其余部分将继续运行,因为它被构建为可以不依赖任何部分地工作。
Reactive programming can be challenging to master. Fortunately, there’s lots of resources to help you out. Some of the best are the books and videos of Manning Publications, publishers of the highest quality tech books and videos you can buy today.
React式编程很难掌握。 幸运的是,有很多资源可以帮助您。 最好的是曼宁出版社(Manning Publications)的书籍和视频,这是您今天可以买到的质量最高的技术书籍和视频的出版商。
Exploring Modern Web Development is a 100% free guide to the most common tools for reactive programming. With this well-rounded sampler, you’ll have a firm foundation for developing awesome web apps with all the modern reactive features and functions today’s users expect.
探索现代Web开发是有关响应式编程的最常用工具的100%免费指南。 有了这个功能全面的采样器,您将为开发具有当今用户期望的所有现代响应特性和功能的出色Web应用程序奠定坚实的基础。
SitePoint users can get 40% off top Manning reactive programming and web development books and videos with the coupon code NLSITEPOINT40. Check out popular bestsellers here.
SitePoint用户可以使用优惠码NLSITEPOINT40享受ManningReact式编程和Web开发书籍以及视频的最高40%折扣。 在这里查看流行的畅销书。
翻译自: https://www.sitepoint.com/reactive-web-apps/
创建react应用程序
相关资源:React-Django:React-Django Web应用程序的简单设置-源码