I attempted to add the Office UI Fabric React Components to an Existing Project. My project is a new ASP.NET Core Web Application created via Visual Studio 2019. This project was created using ASP.NET Core 3.0 (preview 7) via the React.js and Redux template. Once launched, I then followed the Fabric React - Add to Existing Project docs.
- I navigated to the
ClientApp
directory in the created web project. - Executed
npm install office-ui-fabric react --save
. This resulted in over 1,000 vulnerabilities being discovered. - Opened the
./ClientApp/src/components/Home.tsx
file. - Added the line `import {PrimaryButton} from 'office-ui-fabric-react';
- Ran the app
This generated the following error:
Failed to compile
Type error: Namespace 'React' has no exported member 'ElementType'. TS2694
15 | * Slottable version of React.ReactType
16 | */
17 | export declare type ISlottableReactType<TProps extends ValidProps, TShorthandPromp extends ValidShorthand> = React.ElementType<TProps> & ISlotCreator<TProps, TShorthandProp>;
|
18 | /**
19 | * Props generated by Foundation.
20 | */
Please note: the app worked fine before I added the Office UI Fabric React components.