Managing Project Dependencies
Explore how to set up and manage essential Redux dependencies in a React project with Yarn. Understand the benefits of using an offline mirror feature to cache packages, ensuring consistent dependency installations even without network access. This lesson helps you confidently handle project dependencies while maintaining reproducible environments.
We'll cover the following...
Adding Initial Dependencies
New CRA projects come configured with two library dependencies: React and ReactDOM. We’re going to add a few more libraries as we start out. Here’s what we’re going to add:
- Redux: the standard state management library for React apps (because without it, this would be a really short and pointless course)
- React-Redux: the official bindings to allow React components to interact with a Redux store.
- Redux-Thunk: the standard Redux addon for enabling asynchronous “side effects” like AJAX calls and complex synchronous logic outside of components.
- Reselect: the standard Redux addon to help create “selector functions” that encapsulate state lookups and improve app performance.
- Lodash: every useful function you can think of, and a bunch more you didn’t even know existed
We’ll add more libraries as we go along, but this list would be considered a good basic starting set for a typical React+Redux application.
To help ensure that you get the same versions I’m using right now, we’re going to use Yarn to add each library with a specific version. We can also do all this in one big command, so Yarn doesn’t have to repeat some of its work:
...