Installing React
To start using the React library, we need to first install it.
At the time of writing, the latest version of React library is 16.0.0. Over time, React gets updated, so make sure that you use the latest version that is available to you, unless it introduces breaking changes that are incompatible with the code samples provided in this book. Visit https://github.com/PacktPublishing/React-Essentials-Second-Edition to learn about any compatibility issues between the code samples and the latest version of React.
In Chapter 2, Installing Powerful Tools for Your Project, I introduced you to Webpack, which allows us to import all the dependency modules for our application using the import
function. We'll be using import
to import the React library as well, which means that instead of adding a <script>
tag to our index.html
file, we'll be using the npm install
command to install React:
Navigate to the
~/snapterest/
directory and run this command:npm install --save react react...