PowerApps Component Framework (PCF) + React

Create a PCF Component and add React

Prerequisites

Knowledge of essential PCF components. If you need to, please take a look at the PowerApps Component Framework article.

Initialize and create a project

You can open your preferred CLI and navigate to the folder.

pac pcf init -n "name" -ns "namespace" -t [dataset or field]

Create a PCF Component and add React

Install core React Packages

npm install react react-dom

Install core React Packages

Install type definitions for the above packages as dev dependencies

npm install --save-dev @types/react @types/react-dom

npm install --save-dev @types/react @types/react-dom

Create a React Component

It is advisable to create a separate folder to keep all React components.

Create a React Component

Render a react component

Update index.ts file to render a react component

Render a react component

Run the code

Run the command to compile and run the code locally. We can see the react component rendered as part of the PCF component.

npm start watch

Output

PowerApps Component Framework (PCF) + React