What do you think when you see the ongoing modern updates in SharePoint Online? Super cool, isn’t it? Modern UI, Modern Pages, Modern web parts and a lot of modern APIs are revolving around SharePoint nowadays. That brings a lot of features to the SharePoint world. The features, which we missed in past days, are coming in the form of new ones.
Developing applications or customizations against SharePoint has improved a lot when compared with a decade-old version of SharePoint. Today, most of the development firms are using client-side technologies to support all modern mobile devices and modern browsers at the same time. To support modern browsers, SharePoint also changed their style and development strategy.
Now, we have a SharePoint framework, a new development model which supports all modern CSS and JavaScript frameworks. This advancement enables the developer to do customizations among Modern UI and pages in the form of web parts and Extensions.
SharePoint team is projecting the new SharePoint Framework as a replacement for the old development models to customize the SharePoint platform based on the business needs. By using this model, we can use any JavaScript framework to develop the web parts against SharePoint. ReactJS is also among them and Microsoft has also created many components using React.js and Office UI fabric. And they are implementing their components in SharePoint Online for modern page development.
So, we too use the same components for SharePoint Framework development from start to end. To prepare the environment, check the below links.
- Introduction To SharePoint Framework Development
- https://docs.microsoft.com/en-us/sharepoint/dev/spfx/set-up-your-development-environment
By considering that you have the environment setup ready for developing the SharePoint Framework components, we will start the SharePoint Framework web part by using ReactJS step by step guide.
To create a new SharePoint Framework web part, run the below Yeoman command to scaffold the SharePoint Framework project.
Yo @microsoft/sharepoint
The command asks us the initial project information, before generating the project structure.
- What is your solution name? managelists
- Which baseline packages do you want to target for your component(s)? SharePoint Online only (latest)
- Where do you want to place the files? Use the current folder
- Do you want to allow the tenant admin the choice of being able to deploy the solution to all sites immediately without running any feature deployment of adding apps in sites? N
- Which type of client-side component to create? WebPart
- What is your web part name? ManageLists
- What is your web part description? ManageLists description
- Which framework would you like to use? React
The screenshot for the above selection is shown below.

After selecting React, the generator generates the project structure and downloads the required npm packages for the project. Then it adds them under node_modules folder. The project structure looks like this.

From the Project folder, under src -> web parts -> ManageLists, we will have a required file for the web part development. WebParts folder contains two folders (manageLists & loc) and two files (ManageListWebPart.manifest.json & ManageListsWebPart.ts). The below table gives you an idea of the files and folder.
| File / Folder | Remarks |
| ManageListsWebPart.ts | Inherits from BaseClientSideWebaprt and this is the entry file for the web part |
| ManageListsWebPart.manifest.json | Configure the predefined properties |
| Components | Folder contains the React Component files. Each component contains the control or element generation, style and property files |
| Loc | Contains the files to support multi-language |
Before starting the development, we have to categorize the project structure based on the components and objects for easy understanding and smart development. Below are the categorizations for the React SharePoint Framework.
- Web part File and Properties
WebPart file imports from BasicClientsideWebpart. By default, we have this file - Object
Object – Object Declaration - React Components
Each React Component play as a user control and this should be embedded in the web part file. By default, we have this file - Data Providers
Play as the service and which serves the data to the component
From the generator, we have a Components folder and Web part files. We have to manually create the two folders - data provider and common folder object declaration with utility functions.
Under the src -> web parts -> ManageLists folder create Common and DataProviders folder. After creating the folders, project structure looks like below,

Objects and Mock-up Data
The project structure is ready now and we have to prepare the interface the object declaration. In our web part, we are about to retrieve the List title and Id from the web. For that create the object interface by creating new file “IObjects.ts” under the common folder. Add the below snippet in newly created file,
- export interface IList{
- Title?: string;
- Id?: string;
- }
Use export keyword to enable this interface to be used from other files across the project. We have to use import keyword from other files for including this reference. Create an interface for providing data connections between object and web part. Create IDataProvider.ts file under data provider folder and add the below code snippet.
- import { IList } from './../common/IObjects';
- export interface IDataProvider {
- getAllLists(): Promise<IList[]>;
- }
IDataProvider interface used to play as a service to retrieve the values and used by the UI to render within a place. So, define a method called getAllList() to return an array of IList objects. Add a reference to IList by calling import keyword on top of all.
Initiate Mock-up DataSo far, we have the defined the List object and method in the interface. Now we have to call the method to retrieve the values and fill it in IList array. Create a new file “MockupDataProvider.ts” under DataProvider folder and the below snippet.
- import { IList } from './../common/IObjects';
- import { IDataProvider } from './IDataProvider';
- export default class MockupDataProvider implements IDataProvider {
- constructor() {
- }
- public getAllLists(): Promise<IList[]> {
- let _items: IList[];
- //Initiate mockup values to the IList[] object
- _items = [
- {
- Title: 'List Name 1',
- Id: '1'
- },
- {
- Title: 'List Name 2',
- Id: '2'
- },
- {
- Title: 'List Name 3',
- Id: '3'
- },
- {
- Title: 'List Name 4',
- Id: '4'
- },
- {
- Title: 'List Name 5',
- Id: '5'
- }
- ];
- //Returns the mockup data
- return new Promise<IList[]>((resolve) => {
- setTimeout(() => {
- resolve(_items);
- }, 2000);
- });
- }
- }
MockupDataProvider class inherits from IDataProvider to use its defined method. Within getAllLists declare the IList array type variable and assign the values to that. Returning those items _items as array of IList object in asynchronous way using promise.
Render mock-up Data in SharePoint Framework web part: SPFx WebPart Render MethodNavigate to the web parts -> manageLists folder and open ManageWebPartList.ts


Shantha Kumar TPosted Feb 27, 2019, 11:33 AM
Hi Malouke, Yes. It is possible
malouke malloukePosted Feb 27, 2019, 7:41 AM
Hello Shantha , tanks for sharing i am wondering if is possible to import Reactjs application without microsoft fabric Ui to sharepoint?
Prasham SabadraPosted Aug 2, 2018, 4:04 AM
Thanks for Sharing. Very detailed and informative.