Using Redux or Flux 

When React applications begin to grow and become more complex, managing communication between components can become problematic. When using regular React, the way to communicate is to pass down values and callback functions as props to the child components. However, this can be tedious if there are a lot of intermediary components that the callback must pass through. To address these state communication and management-related issues as the React application grows, people turn to use React with libraries and architecture patterns such as Redux and Flux.

It is outside the scope of this book to delve into the details of integrating React with the Redux library or the Flux architecture, but you can consider these options for their growing MERN applications while keeping the following in mind:

  • Redux and Flux utilize patterns that enforce changing states in a React application from a central location. A trick to avoid using Redux or Flux in React applications of manageable sizes is to move all state changes up the component tree to the parent components.
  • Smaller applications work just as well without Flux or Redux.
You can learn more about using React with Redux at https://redux.js.org/, and about using React with Flux at facebook.github.io/flux/.

You can choose to integrate Flux or Redux based on your application size and complexity. In the next section, we will discuss the security implementations applied to the MERN applications developed in this book and the possible enhancements that could be made.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset