The newline Guide to Modernizing an Enterprise React App
In this course, you'll learn all the pieces that go into modernizing an existing React application so it can take advantage of the latest framework features and run well for years to come.
10h 35m54 Video Lessons
Published | Updated
What You Will Learn
How to modernize an existing React application according to today's standards
How React Hooks work compared to class components
How config tools Volta and Node engines simplify development
How to set up ESLint and Prettier to improve code quality
How to upgrade an existing React app and refactor the app as you go
How to write integration tests with React Testing Library to ensure app functionality
How end-to-end tests with Cypress can test mission critical user flows
How to incorporate a component library to speed up design and development time
Why this course
The newline Guide to Modernizing an Enterprise React application will cover everything you need to know to confidently work on a React application of any size, in any state, and leave it better than when you found it.
While many React tutorials start with the latest version of React, or gloss over all the other things required to make sure apps vital to a company's success keep running, this course does not. In 54 lessons spanning 10 modules, it tackles head-on, the many things that must be considered when building and maintaining large, complex React apps.
As you progress through this course, you'll gain a deeper understanding for how and why React Hooks came to be, the importance of various types of automated testing and project configuration, and how to leverage design systems to improve your application. You will gain a detailed understanding of how to modernize a React app in a real-world scenario, bringing it in line with today's development standards.
Part one: tooling and setup
The first part of this course will consist of getting familiar with our example application, and doing the behind-the-scenes work to set it up for success.
We'll learn about why React Hooks came about and how to use them, how to upgrade an outdated React app successfully, and how to use tools like Volta, ESLint and Prettier to improve the app's code and development experience.
- Module 0: Meet Hardware Handler - our outdated, but promising React application.
- Module 1: React Hooks - why they were created, the issues they solve and how the most common ones work.
- Module 2: Upgrading a React app - our app needs an upgrade to use Hooks, and we'll streamline development with Volta.
- Module 3: Project configuration - adding Prettier and ESLint to our app will dramatically improve code quality.
Part two: refactoring the code
With our app configured for success, we'll get down to the business of refactoring Hardware Handler.
I'll show you my strategy for converting class components to functional ones, and we'll go file-by-file keeping the app's functionality intact while upgrading it to use hooks - including custom hooks, and the Context API.
- Module 4: Classes to functions - we'll take every class component and turn it into a functional component.
- Module 5: Custom hooks - we'll identify where custom hooks can simplify our functional components further.
- Module 6: Context API - a few strategically placed React contexts will round out our code improvements.
Part three: testing
An updated application is only half the battle for enterprise-level apps; development teams must also be confident in their continued success as the apps expand in size and scope.
We'll add automated testing to our app using the widely accepted testing frameworks React Testing Library and Cypress.
- Module 7: Integration testing - the popular combination of Jest and React Testing Library will be used to unit test smaller pieces of our app.
- Module 8: End-to-end testing - the ease of writing e2es with Cypress Studio will blow you away.
Bonus: design systems
Finally, I've included a special bonus module about how to incorporate design systems into an already existing application, and switch out components in a systematic way. Design systems and component libraries are quickly gaining ground - especially in big orgs with lots of apps and development teams.
Being able to effectively use one is an important skill to learn.
- Module 9: Ant Design - we'll swap in the robust design system's components to handle our app's more complex interactions for us.
In 10 modules, we'll go step-by-step taking an app from outdated in every way to up to today's high standards, giving you ample practice and hands-on examples along the way.
If you've been wanting to get more confident in your React skills and see what it takes to build enterprise apps in today's world, this is the course for you.
Guide to Modernizing an Enterprise React App Welcome
Introduction to Modernizing an Enterprise React App
Hardware Handler Overview
Get familiar with the sample React application's folder structure and current functionality.
Module 1 Introduction
Introduction to Module 1: React Hooks
Introducing React Hooks
Learn about the motivation behind React Hooks, the benefits it can bring, and the rules that apply to all Hooks in a React application.
The useState Hook is the most similar to traditional state in React class-based components, and we'll look at examples of how it works to keep track of state in functional components.
useEffect is a game-changing hook: originally compared to lifecycle methods in React components, it's close but not truly a direct comparison.
While less often discussed, the useRef Hook deserves covering because a time will come when it's the right solution to reach for; here, we'll talk about how useRef's "mutable" value property can be useful.
Context is a powerful API to pass state within React applications, and with the introduction of the useContext Hook, accessing state in any component (class or functional) is possible.
Custom hooks are arguably the most important addition of all the hooks released with React 16.8.0. Explore how custom hooks can dramatically simplify sharing code between components.
Module 1 Summary
This lesson is a summary of the React Hooks we've covered in Module 1.0
Upgrade the React App
Module 2 Introduction
Introduction to Module 2: Upgrading React App Version
Upgrade the React App Version
Before we can do anything else, we must upgrade our sample app's React version to start taking advantage of the advances.
Lock Down the Node and Yarn Versions
Avoid one of the most common developer woes: different devs coding with different environment versions with the help of Volta and Node Engines.
Module 2 Summary
This lesson is a summary of module 2.0, where we upgraded our React version and locked in our project configuration.
Configure Prettier and ESLint
Module 3 Introduction
Introduction to module 3: Code formatting setup
Set Up Prettier
Code formatting, especially when it's set up, so you don't even have to think about it, is the best.
Set Up ESLint
Module 3 Summary
This lesson is a summary of the automated code formatting and linting we set up with the help Prettier and ESLint in Module 3.0.
Refactor React Classes to React Hooks
Module 4 Introduction
Introduction to Module 4: Refactoring to hooks
We dip our toes into converting a class component to a functional one with Hardware Handler's home page.
We get our first real taste of adding hooks while refactoring the App component.
The checkout page uses multiple API calls to correctly display the items a product manager wants to ship to stores.
Ah forms, a painful Achilles heel of most web applications (React apps included) since the beginning of time.
We saved the best (i.e. the most complicated) component for last. The product list, with its filters and products, is no match for our newly honed skills though.
Module 4 Summary
This lesson is a summary of Module 4.0, where we systematically refactored our app's outdated class components to now use React Hooks.
Create Custom Hooks for the App
Module 5 Introduction
Introduction to module 5: Custom hooks
Our First Custom Hook: useDepartments
We'll write our first custom hook to fetch department info for our application in one centralized place.
Simplify Complex Components with the useProducts Hook
Custom hooks are good for more than just drying up duplicated code; they also help simplify our components.
The useCheckout Hook will do Double Duty in our App
Some custom hooks can help simplify code beyond the original components they touch.
Module 5 Summary
This lesson is a summary of module 5.0's custom hooks we added to Hardware Handler.
Incorporate the Context API
Module 6 Introduction
Introduction to module 6: The useContext Hook
Create a Context Hook to Handle CheckoutItems
Bring the Context API into Hardware Handler to decrease our reliance on props.
Contexts can be Used to Share Functions within an App Too
Context doesn't necessarily need to live at the top level of a component to be useful.
Module 6 Summary
This lesson summarizes our addition of the Context API and useContext Hooks in Module 6.0.
Integration Testing with Jest and React Testing Library
Module 7 Introduction
Introduction to module 7: Unit testing
Introducing React Testing Library
Set Up Integration Testing in Our App
We've got a little setup work to do before we get to the actual business of writing our tests.
Test the Container Components
React Testing Library's approach to integration testing like a user would interact with the DOM works very well with React's function-based components.
Test our Custom Hooks
Testing a custom hook might sound intimidating at first, but there are actually some repeatable steps that take a lot of the guesswork and mystery out of it.
Test our API Service Calls
Not all of our testing for our React app relies so heavily on RTL — some files Jest can handle on its own.
Module 7 Summary
This lesson is a summary of module 7.0, where we started adding unit and integration tests to our app to increase our confidence our app works as expected.
End-to-End Testing with Cypress
Module 8 Introduction
Introduction to module 8: Cypress e2es
End-to-end testing has never been the easiest thing to do, but Cypress challenges that statement in a big way.
Set up End-to-End Tests
Cypress gives us a big helping hand organizing and getting started with our own e2es.
Write End-to-End Test Flows
Cypress makes the process of writing e2es relatively simple with lots of built-in methods and documentation to show you the way to use it effectively.
Try out Cypress Studio
The Studio feature makes e2e test writing faster and easier than it's ever been before.
Module 8 Summary
This lesson is a summary of module 8.0, where we integrated Cypress into a React app and wrote automated end-to-end tests.
Bonus Module: Add a Design System Library
Module 9 Introduction
Introduction to module 9: Design system libraries
Why use a Design System?
Design systems provide more than just a bunch of prebuilt components for developers.
Add Ant Design to our App
Setting Ant Design up takes a little doing because it's so customizable.
Swap out Some Simple Components
Ant Design's thorough documentation makes the process of replacing custom components less difficult than it might otherwise be.
Sub in More Complex Components
While these components require a little more effort to get working, the improvements they provide are worth the time.
Module 9 Summary
This lesson summarizes module 9.0, where we learned about the benefits of a design system and incorporated the popular Ant Design into our own app.
Summing It All Up
Recapping Modernizing an Enterprise React App
Can you believe how far we've come?
Frequently Asked Questions
Who is this course for?
Intermediate to advanced developers already comfortable with React and somewhat familiar with the React framework but not necessarily well-versed with the newest syntax like React Hooks. Also, for anyone who wants to learn the kinds of things that go into large, long-lived enterprise-sized React apps: the tooling and configuration, testing, design systems and strategies for updating existing apps to keep them fresh and relevant
I already know how to use Hooks, will I still get something out of this course?
You sure will. This course goes way beyond React Hooks because the React apps supporting big companies encompass way more than that. We cover integration and end-to-end testing, project tooling and configuration like Volta, Prettier and ESLint, design system library integration and more. You may know React, but there's a lot more to it than just Hooks
What if I need help?
You can ask us questions anytime through the community Discord channel #modernizing-an-enterprise-react-app or by sending us a message.
newline Pro Subscription
Get unlimited access to the course, plus 60+ newline books, guides and courses. Learn More
Charged monthly. Free to cancel anytime.
Get lifetime access to this course.