Enterprise React Development with UmiJS: Learn efficient techniques and best practices to design and develop modern frontend web applications
()
About this ebook
UmiJS is the Ant Group's underlying frontend development framework, an open source project for developing enterprise-class frontend applications. In this book, you'll get hands-on with single-page application development using UmiJS. By following practical step-by-step examples, you'll develop essential skills to build and publish your apps and create a modern user experience with responsive interfaces.
This book will help you learn the essential features of UmiJS and how to set up and build a project from scratch using React, Less, and TypeScript. You'll study Ant Design, a framework based on solid design concepts that provides a series of React components to accelerate interface development. Along the way, you'll see how to make requests and develop the frontend using simulated data while ensuring that your app has a high level of security and feedback. You'll also discover ways to improve your code quality and readability using formatting tools.
By the end of the book, you'll have learned how to use UmiJS to design user interfaces, as well as compile, test, and package your app locally, and deliver your app by deploying it to online services.
Related to Enterprise React Development with UmiJS
Related ebooks
React Application Architecture for Production: Learn best practices and expert tips to deliver enterprise-ready React web apps Rating: 0 out of 5 stars0 ratingsNext.js Quick Start Guide: Server-side rendering done right Rating: 0 out of 5 stars0 ratingsMastering MEAN Stack: Build full stack applications using MongoDB, Express.js, Angular, and Node.js (English Edition) Rating: 0 out of 5 stars0 ratingsMastering ABP Framework: Build maintainable .NET solutions by implementing software development best practices Rating: 0 out of 5 stars0 ratingsVue.js Quick Start Guide: Learn how to build amazing and complex reactive web applications easily using Vue.js Rating: 0 out of 5 stars0 ratingsVue.js for Jobseekers: A complete guide to learning Vue.js, building projects, and getting hired (English Edition) Rating: 0 out of 5 stars0 ratings.Net Framework and Programming in ASP.NET Rating: 0 out of 5 stars0 ratingsReal-World Next.js: Build scalable, high-performance, and modern web applications using Next.js, the React framework for production Rating: 0 out of 5 stars0 ratingsBeginning React: Simplify your frontend development workflow and enhance the user experience of your applications with React Rating: 0 out of 5 stars0 ratingsBlazor WebAssembly by Example: A project-based guide to building web apps with .NET, Blazor WebAssembly, and C# Rating: 0 out of 5 stars0 ratingsASP.NET Core 8 and Angular: Full-stack web development with ASP.NET Core 8 and Angular Rating: 0 out of 5 stars0 ratingsReact.js Design Patterns: Learn how to build scalable React apps with ease (English Edition) Rating: 0 out of 5 stars0 ratingsSelenium with C#: Learn how to write effective test scripts for web applications using Selenium with C# (English Edition) Rating: 0 out of 5 stars0 ratingsSvelteKit Up and Running: Leverage the power of a next-generation web framework to build high-performance web apps with ease Rating: 0 out of 5 stars0 ratingsBuilding Modern SaaS Applications with C# and .NET: Build, deploy, and maintain professional SaaS applications Rating: 0 out of 5 stars0 ratingsBuilding Serverless Applications with Python: Develop fast, scalable, and cost-effective web applications that are always available Rating: 0 out of 5 stars0 ratingsObject Oriented Programming with Angular: Build and Deploy Your Web Application Using Angular with Ease ( English Edition) Rating: 0 out of 5 stars0 ratingsServiceNow Application Development Rating: 0 out of 5 stars0 ratingsSpring Boot 3.0 Crash Course Rating: 0 out of 5 stars0 ratingsPractical ASP.NET Web API Rating: 0 out of 5 stars0 ratingsVuex Quick Start Guide: Centralized State Management for your Vue.js applications Rating: 0 out of 5 stars0 ratingsASP.NET Core 5 and Angular: Full-stack web development with .NET 5 and Angular 11 Rating: 0 out of 5 stars0 ratingsASP.NET Core 3 and React: Hands-On full stack web development using ASP.NET Core, React, and TypeScript 3 Rating: 0 out of 5 stars0 ratingsCoding Languages: Angular With Typescript, Machine Learning With Python And React Javascript Rating: 0 out of 5 stars0 ratingsASP.NET Core 6 and Angular: Full-stack web development with ASP.NET 6 and Angular 13 Rating: 0 out of 5 stars0 ratings
Internet & Web For You
How to Be Invisible: Protect Your Home, Your Children, Your Assets, and Your Life Rating: 4 out of 5 stars4/5Coding All-in-One For Dummies Rating: 4 out of 5 stars4/5No Place to Hide: Edward Snowden, the NSA, and the U.S. Surveillance State Rating: 4 out of 5 stars4/5Social Engineering: The Science of Human Hacking Rating: 3 out of 5 stars3/5Six Figure Blogging Blueprint Rating: 5 out of 5 stars5/5Coding For Dummies Rating: 5 out of 5 stars5/5Everybody Lies: Big Data, New Data, and What the Internet Can Tell Us About Who We Really Are Rating: 4 out of 5 stars4/5The Hacker Crackdown: Law and Disorder on the Electronic Frontier Rating: 4 out of 5 stars4/5The Gothic Novel Collection Rating: 5 out of 5 stars5/5The $1,000,000 Web Designer Guide: A Practical Guide for Wealth and Freedom as an Online Freelancer Rating: 4 out of 5 stars4/5Get Rich or Lie Trying: Ambition and Deceit in the New Influencer Economy Rating: 0 out of 5 stars0 ratingsThe Mega Box: The Ultimate Guide to the Best Free Resources on the Internet Rating: 4 out of 5 stars4/5Podcasting For Dummies Rating: 4 out of 5 stars4/5HTML in 30 Pages Rating: 5 out of 5 stars5/5How to Disappear and Live Off the Grid: A CIA Insider's Guide Rating: 0 out of 5 stars0 ratingsUltimate guide for being anonymous: Avoiding prison time for fun and profit Rating: 5 out of 5 stars5/5Content Chemistry: The Illustrated Handbook for Content Marketing Rating: 5 out of 5 stars5/5Grokking Algorithms: An illustrated guide for programmers and other curious people Rating: 4 out of 5 stars4/5Stop Asking Questions: How to Lead High-Impact Interviews and Learn Anything from Anyone Rating: 5 out of 5 stars5/5Beginner's Guide To Starting An Etsy Print-On-Demand Shop Rating: 0 out of 5 stars0 ratingsHow to Destroy Surveillance Capitalism Rating: 4 out of 5 stars4/5Blogging For Dummies Rating: 0 out of 5 stars0 ratingsPython QuickStart Guide: The Simplified Beginner's Guide to Python Programming Using Hands-On Projects and Real-World Applications Rating: 0 out of 5 stars0 ratingsCybersecurity For Dummies Rating: 5 out of 5 stars5/5Tor and the Dark Art of Anonymity Rating: 5 out of 5 stars5/5The Beginner's Affiliate Marketing Blueprint Rating: 4 out of 5 stars4/5Cybersecurity All-in-One For Dummies Rating: 0 out of 5 stars0 ratingsAn Ultimate Guide to Kali Linux for Beginners Rating: 3 out of 5 stars3/5
Reviews for Enterprise React Development with UmiJS
0 ratings0 reviews
Book preview
Enterprise React Development with UmiJS - Douglas Alves Venancio
BIRMINGHAM—MUMBAI
Enterprise React Development with UmiJS
Copyright © 2022 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing or its dealers and distributors, will be held liable for any damages caused or alleged to have been caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
Associate Group Product Manager: Pavan Ramchandani
Publishing Product Manager: Aaron Tanna
Senior Editor: Aamir Ahmed
Content Development Editor: Rakhi Patel
Technical Editor: Saurabh Kadave
Copy Editor: Safis Editing
Project Coordinator: Manthan Patel
Proofreader: Safis Editing
Indexer: Hemangini Bari
Production Designer: Joshua Misquitta
Marketing Coordinater: Anamika Singh
First published: April 2022
Production reference: 1220422
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham
B3 2PB, UK.
ISBN 978-1-80323-896-8
www.packt.com
I want to dedicate my work to my parents, Terezinha and Donisete, and my sisters Jemima and Elisama, for being by my side in the worst and best moments of my life, and all people who believed in me and are my family in Christ.
– Douglas Alves
Contributors
About the author
Douglas Alves Venancio has a background in systems analysis and development. His passion is to help customers and the community solve problems. Over the past few years, he has mainly worked with digital products and innovation, delivering the best user experience possible with modern web applications. Currently, Douglas works at the largest hospital in Latin America, innovating in telemedicine and digital transformation.
I want to pay my special regards to the entire team who worked with me on the success of this book and to Raul Oliveira for his valuable feedback!
I'd also like to express my gratitude to Teena Evans, who invested in me early in my career.
Finally, I would also like to thank my colleagues at AX4B for their support during the time we were together and to Albert Einstein Hospital and my co-workers for their support and for being part of my professional growth.
About the reviewer
Raul Oliveira is a developer with experience in frontend, backend, and robotic process automation. He has assisted in system integrations and the requirements gathering process and has architected, prototyped, developed, tested, and implemented enterprise solutions. He has particular experience in using React, Ant Design, UmiJS, Angular, Node, Java, Amazon Web Services, and SQL and NoSQL databases, among others. A graduate of systems analysis and development, he is curious about everything that involves technology and is always willing to help others.
Table of Contents
Preface
Part 1: Configuring UmiJS and Creating User Interfaces
Chapter 1: Environment Setup and Introduction to UmiJS
Technical requirements
Setting up our environment and configuring UmiJS
Introduction to UmiJS and creating your first project
Installing the EditorConfig and Prettier extensions
Understanding the UmiJS folder structure and its main files
Adding config and locales folders
Runtime configuration
Exploring the Umi CLI and adding pages
Understanding routing and navigation in UmiJS
Understanding path parameters and query strings
Conventional routing
Navigating between pages
Using Umi UI
Adding Ant Design components
Summary
Chapter 2: Creating User Interfaces with Ant Design
Technical requirements
Introduction to the project and Ant Design
Introduction to Ant Design components
Setting up the layout and theme
Adding right-side content to the layout header
Creating the home page and setting up i18n
Setting up internationalization
Creating the Opportunities and Customers pages
Creating the Reports page
Summary
Chapter 3: Using Models, Services, and Mocking Data
Technical requirements
Defining response types and column types
Creating column definitions for ProTable
Creating the opportunity details page
Defining the activities table columns
Simulating data and API responses
Sending HTTP requests with Umi request
Using models for sharing states and logic
Summary
Part 2: Protecting, Testing, and Deploying Web Applications
Chapter 4: Error Handling, Authentication, and Route Protection
Technical requirements
Modifying the login page and defining the HTML template
Modifying the login page
Defining the default HTML template
Storing and globally accessing user information
Protecting application routes based on user roles
Using the useAccess hook
Handling HTTP error responses
Summary
Chapter 5: Code Style and Formatting Tools
Technical requirements
Understanding code style and consistency
Working with EditorConfig and Prettier
Working with EditorConfig
Working with Prettier
Configuring ESLint and Prettier
Summary
Chapter 6: Testing Front-End Applications
Technical requirements
Understanding software testing
Understanding integration testing
Understanding end-to-end testing
Writing tests with Jest
Understanding the describe method
Executing instructions before and after tests
Testing interfaces with Puppeteer
Testing the access and layout plugins
Testing the opportunity editing feature
Summary
Chapter 7: Single-Page Application Deployment
Technical requirements
Creating a mock server with Mockachino
Compiling the application and setting environment variables
Configuring the API URL environment variable
Hosting the application on AWS Amplify
Understanding more Amplify settings
Summary
Other Books You May Enjoy
Preface
UmiJS is a scalable JavaScript framework for building enterprise-level frontend applications. Umi uses React and is based on a routing system that allows you to make fast and responsive applications.
In this book, we will build a frontend web application for a customer relationship management (CRM) system. Starting with your environment setup, I will introduce you to the main features of UmiJS and how a project is structured. After that, we will explore Ant Design, a design system with a vast library of React components for quickly building modern and responsive user interfaces that deeply integrate with Umi.
You will also learn an approach based on models and services to handle HTTP requests and responses and control an application's state in complex scenarios.
After learning to work with Umi, you will explore how to improve code quality by implementing a consistent code style and using formatting tools such as Prettier and EditorConfig. You will also learn how to design and implement tests for frontend applications.
Finally, you will host your CRM frontend application on AWS Amplify, an out-of-the-box platform for frontend developers to build full-stack applications using several AWS services.
Who this book is for
This book is for React developers who are new to UmiJS and building large web applications. I assume you already know React and the basics of designing web applications.
What this book covers
Chapter 1, Environment Setup and Introduction to UmiJS, is where you will install all the tools you need to follow the exercises in this book and learn the main features of UmiJS.
Chapter 2, Creating User Interfaces with Ant Design, is where you will explore the Ant Design system and create interfaces using its React components library.
Chapter 3, Using Models, Services, and Mocking Data, is where you will learn an approach based on models and services to handle requests, manage application state, and simulate data using mock files.
Chapter 4, Error Handling, Authentication, and Route Protection, is where you will implement error handling, security controls, and authorization on your application.
Chapter 5, Code Style and Formatting Tools, is where we will discuss code style and configure Prettier and EditorConfig to automatically format and enforce a consistent code style in your project.
Chapter 6, Testing Front-End Applications, is where we will discuss software testing and implement some tests for your application using Puppeteer.
Chapter 7, Single-Page Application Deployment, is where you will prepare your application for deployment and host it on AWS Amplify.
To get the most out of this book
To complete these book exercises, you only need a computer with a modern operating system (such as Windows 10/11, macOS 10.15, or Ubuntu 20.04). I will give you instructions on how to install the other required software in Chapter 1, Environment Setup and Introduction to UmiJS.
It's important to mention that you will need a free GitHub account to access the code examples and to complete Chapter 7, Single-Page Application Deployment.
If you are using the digital version of