Skip to content

Commit 1470239

Browse files
vogtnshweaver-MSFT
andauthored
adding description to sample (#643)
Co-authored-by: Shane Weaver <[email protected]>
1 parent 04720ed commit 1470239

File tree

1 file changed

+38
-1
lines changed

1 file changed

+38
-1
lines changed

samples/react-app/README.md

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,41 @@
1-
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
1+
# React sample for Mgt
2+
3+
This sample demonstrates the integration of the Microsoft Graph Toolkit into a React application using [Create React App](https://github.com/facebook/create-react-app).
4+
5+
The sample uses the library [@microsoft/mgt-react](https://www.npmjs.com/package/@microsoft/mgt-react) to simplify usage of [Microsoft Graph Toolkit (mgt)](https://aka.ms/mgt) web components in React. The library wraps all mgt components and exports them as React components.
6+
7+
8+
## Setting up MGT in a React app
9+
10+
11+
1. Install
12+
```bash
13+
npm install @microsoft/mgt-react @microsoft/mgt
14+
```
15+
16+
or
17+
18+
```bash
19+
yarn add @microsoft/mgt-react @microsoft/mgt
20+
```
21+
22+
2. mgt-react does not import the Microsoft Graph Toolkit components automatically. Make sure to have the toolkit imported in your app somewhere:
23+
24+
```js
25+
import `@microsoft/mgt`
26+
```
27+
28+
29+
3. In your `App.js` or other components, add an import with the components you want to use
30+
31+
```js
32+
import { Login, Agenda, Person } from '@microsoft/mgt-react';
33+
```
34+
35+
36+
4. Now you can use the components in React!
37+
38+
<br/><br/>
239

340
## Available Scripts
441

0 commit comments

Comments
 (0)