Book Image

Redux Made Easy with Rematch

By : Sergio Moreno
Book Image

Redux Made Easy with Rematch

By: Sergio Moreno

Overview of this book

Rematch is Redux best practices without the boilerplate. This book is an easy-to-read guide for anyone who wants to get started with Redux, and for those who are already using it and want to improve their codebase. Complete with hands-on tutorials, projects, and self-assessment questions, this easy-to-follow guide will take you from the simplest through to the most complex layers of Rematch. You’ll learn how to migrate from Redux, and write plugins to set up a fully tested store by integrating it with vanilla JavaScript, React, and React Native. You'll then build a real-world application from scratch with the power of Rematch and its plugins. As you advance, you’ll see how plugins extend Rematch functionalities, understanding how they work and help to create a maintainable project. Finally, you'll analyze the future of Rematch and how the frontend ecosystem is becoming easier to use and maintain with alternatives to Redux. By the end of this book, you'll be able to have total control of the application state and use Rematch to manage its scalability with simplicity.
Table of Contents (18 chapters)
1
Section 1: Rematch Essentials
6
Section 2: Building Real-World Web Apps with Rematch
11
Section 3: Diving Deeper into Rematch

How does Rematch work?

Internally, Rematch is pretty simple. That's why calling it a framework isn't quite correct; it's just a higher layer without the Redux boilerplate.

Let's analyze Rematch in depth. In Figure 2.4, we introduce the Rematch model:

Figure 2.4 – Rematch architecture

Rematch models are among the most important parts of your store because they allow you to define the initial state of the model, the reducers, and the effects.

Any model is built on the basis of these properties:

Name

Models can contain a name that will become a key in the Redux store – this means that you will be able to access the state of a model or dispatch actions from a model using its name. Now, a name is not mandatory – if you don't provide a name, Rematch will use the object keys provided to the init() function instead.

The init() function returns a Rematch store, which is essentially a Redux store with...