Book Image

Flux Architecture

By : Adam Boduch
Book Image

Flux Architecture

By: Adam Boduch

Overview of this book

Whilst React has become Facebook’s poster-child for clean, complex, and modern web development, it has quietly been underpinned by its simplicity. It’s just a view. The real beauty in React is actually the architectural pattern that handles data in and out of React applications: Flux. With Flux, you’re able to build data-rich applications that engage your users, and scale to meet every demand. It is a key part of the Facebook technology stack that serves billions of users every day. This book will start by introducing the Flux pattern and help you get an understanding of what it is and how it works. After this, we’ll build real-world React applications that highlight the power and simplicity of Flux in action. Finally, we look at the landscape of Flux and explore the Alt and Redux libraries that make React and Flux developments easier. Filled with fully-worked examples and code-first explanations, by the end of the book, you'll not only have a rock solid understanding of the architecture, but will be ready to implement Flux architecture in anger.
Table of Contents (21 chapters)
Flux Architecture
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Index

Action names and constants


Any large Flux application will have a lot of actions. This is why having action constants and sensible action names matter. The focus of this section is to discuss possible naming conventions for actions and to get organized with our actions. Constants help with reducing repetitive strings that are error-prone, but we'll also need to think about the best way to organize our constants. We'll also look at static action data—this will also help us reduce the amount of action dispatch code we have to write.

Action name conventions

All actions in a Flux system have a name. The name is important because it tells whoever is looking at it a lot about what it does. An application where there are less than ten actions is unlikely to have a strong naming convention requirement, because we can easily figure out what these actions do. However, it's equally unlikely we'd use Flux to implement a small application—Flux is for systems that need to scale. This means that there's...