Book Image

Redux Quick Start Guide

By : James Lee, Tao Wei, Suresh Kumar Mukhiya
Book Image

Redux Quick Start Guide

By: James Lee, Tao Wei, Suresh Kumar Mukhiya

Overview of this book

Starting with a detailed overview of Redux, we will follow the test-driven development (TDD) approach to develop single-page applications. We will set up JEST for testing and use JEST to test React, Redux, Redux-Sage, Reducers, and other components. We will then add important middleware and set up immutableJS in our application. We will use common data structures such as Map, List, Set, and OrderedList from the immutableJS framework. We will then add user interfaces using ReactJS, Redux-Form, and Ant Design. We will explore the use of react-router-dom and its functions. We will create a list of routes that we will need in order to create our application, and explore routing on the server site and create the required routes for our application. We will then debug our application and integrate Redux Dev tools. We will then set up our API server and create the API required for our application. We will dive into a modern approach to structuring our server site components in terms of Model, Controller, Helper functions, and utilities functions. We will explore the use of NodeJS with Express to build the REST API components. Finally, we will venture into the possibilities of extending the application for further research, including deployment and optimization.
Table of Contents (16 chapters)
Title Page
Copyright and Credits
Dedication
About Packt
Contributors
Preface
Index

Using react-router-dom


Adding react-router-dom is a piece of cake by now. Just take yarn or npm and add it to your project. Let's get started with our boilerplate code. Copy all of the starter files. We already added react-router-dom to our app in Chapter 3, Routing, and Chapter 4, The Concept of Immutability. If your app does not have react-router-dom, you can add it as follows:

yarn add react-router-dom --exact
OR
npm install react-router-dom

In our health application, we will have the following pages:

Page Description

Page Component

Page Routes

Home page

HomePage

/

About page

AboutPage

/about

Contact page

ContactPage

/contact

Register page

RegisterPage

/register

Login page

LoginPage

/login

Forget password

ForgetPassword

/forget-password

Reset password

ResetPassword

/reset-password

Dashboard page

Dashboard

/admin/dashboard

List of users

UsersList

/admin/users

View single user

UserDetail

/admin/users/:userID

Edit single user

EditUser

/admin/users/:userID/edit

Table 6.1: List of routes under consideration

The react-router-dom...