logo

The very beginning: Installing Motion for React.

These steps are only needed if you want to run any of the projects locally. During the whole course you will be able to use the playground, and Motion for React will be installed automatically for you.

Already know how to install packages?

This chapter is mainly meant for people who are new to the concept of NPM packages. If that isn't you, feel free to skip ahead to the next lesson.

Setting Up Your Environment

To get started, you'll need a React project set up. If you haven't already, create a new React app using Vite or your preferred method.

Installing Motion for React

Now, let's get Motion into your project. You can do this using npm, yarn, or pnpm, depending on your preference.

Make sure to navigate to the folder where you installed your project, and run the following command.

Terminal
1# with npm
2npm install motion
3
4# with yarn
5yarn add motion
6
7# with pnpm
8pnpm add motion

Verifying the Installation

After installation, you can verify that Motion is successfully added to your project by checking your package.json file. You should see motion listed under dependencies.

Struggling with this?

If you are struggling with installing packages locally, feel free to post in #dev-questions channel on our Slack!