Skip to main content

React quick start

Beginner
Getting started
Quick start

One key feature of ICP is its ability to serve web assets directly in a web browser. When an application is deployed to ICP, users from around the world can access it using only the smart contract's URL without requiring the developer set up a domain name or other web configuration.

Open your terminal and deploy a React app in minutes using these steps.

Prerequisites

Download and install Node.js.

1. Install the IC SDK.

sh -ci "$(curl -fsSL https://internetcomputer.org/install.sh)"

Confirm the IC SDK has been installed (you may need to open a new terminal window):

dfx --version

2. Download the React template.

Create a new empty directory, then download the project template:

mkdir react-project
cd react-project
npx degit jessiemongeon1/vite-react-motoko

This example project uses Motoko, React, and TypeScript template to create a simple counter application.

3. Setup the project using npm.

npm run setup

4. Deploy the project.

dfx deploy --playground

4. Interact with the app.

Open the frontend URL in a web browser. You'll see the template React frontend interface.

Congratulations, you just created your first internet-native React dapp!