Automate Marketing Initiatives with Salesforce Marketing Cloud Learn More

Creating SPFx Web Parts: Key Tip

Sharepoint Framework

The SharePoint Framework (SPFx) is a web page and web part-based model. It offers complete assistance for client-aspect SharePoint development,  clean integration with SharePoint records,  and extending Microsoft groups. 

Further, we’ll learn how to make a web part with SharePoint Framework and how to create our first SPFx web part.

Setting Up SPFX Development Environment

Install:  
1.node js 
2. Install any code editor that supports client-side development to create webpart: like Visual studio code
3. yeoman and gulp: npm install -g yo gulp 
4. Yeoman SharePoint generator: – npm install -g @microsoft/generator-sharepoint 

To get the node, gulp, and yeoman versions used: –  npm list -g –depth=0 

Screenshot 418 1024x193 1

Create the First Web Part

Web components are UI blocks that can be shown on a SharePoint page. 

By following the guidelines, let’s create a new  SPFx web part project.

  • Open the command prompt and
  • Create the folder where you want to create your webpart solution: md demoWebpart 
  • Enter in the folder: cd demoWebpart 

Further, to create a new solution on the present location, use the following command in the terminal yo @microsoft/sharepoint

After that generator will ask for the following user input: 

  • What is your solution name? (spfx-webpart): demowebpart 
  • Which type of client-side component to create?: webpart 
  • What is your Web part name?: demoWebpart 
  • Which template would you like to use: noframework 
Screenshot 420 1024x335 1

Following this procedure, your demo Web Part will be created. Further, we can test the Web Part on a workbench after creating the solution.

Use gulp serve to test the web part on the workbench.

To deploy the build: 
gulp bundle –ship 
gulp package-solution –ship 

A place for big ideas.

Reimagine organizational performance while delivering a delightful experience through optimized operations.

Web Part Using React Framework:

React components contain many functionalities and provides ability to receive properties. Components can transfer information among each other through properties. As a result, in this way you can control which view of web part will be display at any specific time slot.

For instance, the multiple views are built individually to make the programming and maintenance easier. Further, this also makes it easy for a group of developers to work on the same web part at the same time. Meanwhile, splitting the multiple views into independent React components, on the other hand, allows switching between them much easier. 

Creating Web Part Using React Framework:

yo @microsoft/sharepoint

What is your solution name? (spfx-webpart): webpartWithReact 

 

Which type of client-side component to create?: webpart 


What is your Web part name?: webpartWithReact 


Which template would you like to use: React

After this, your web part will be created.

In webpart, three files are created in src/webpart/component 


WebpartWithReactProp.ts: in this, we declare the properties 


WebpartWithReact.tsx: in this, we can use properties that are declared in WebpartWithReactProp.ts file 


WebpartWithReact.module.scss: write the CSS

 

Therefore, SharePoint web parts provide functionality for web developers to create an extremely efficient and user-friendly solution. 

Further, Web parts can display lists and libraries, data from external data sources, and content from other sites.

 

 To sum up, with versatility and inter-combinability SharePoint web part is an immensely powerful means to build up the content.

Top Stories

Tracking and Analyzing E commerce Performance with Odoo Analytics
Tracking and Analyzing E-commerce Performance with Odoo Analytics
Odoo is famous for its customizable nature. Businesses from around the world choose Odoo because of its scalability and modality. Regardless of the business size, Odoo can cater to the unique and diverse needs of any company. Odoo has proven its capacity and robust quality in terms of helping businesses
Highlighting 8 Ways to Optimize Inventory Management Using Odoo's Flexibility
Highlighting 8 Ways to Optimize Inventory Management Using Odoo's Flexibility
Odoo’s flexibility contributes to the optimization of the company's inventory management. From overseeing, controlling, ordering, and stocking, Odoo’s adaptable nature can provide an adequate system to streamline complex processes. A good inventory management system is the key to increasing productivity, implementing cost-effective operations, retaining loyal customers, and saving time and
Delve into the Integration Potential of Blockchain in Odoo
Delve into the Integration Potential of Blockchain in Odoo
Odoo is famous for its customizable nature. Businesses from around the world choose Odoo because of its scalability and modality. Regardless of the business size, Odoo can cater to the unique and diverse needs of any company. Odoo has proven its capacity and robust quality in terms of helping businesses
Tips for Optimizing and Troubleshooting Odoo POS Development
Tips for Optimizing and Troubleshooting Odoo POS Development?
Odoo is famous for its customizable nature. Businesses from around the world choose Odoo because of its scalability and modality. Regardless of the business size, Odoo can cater to the unique and diverse needs of any company. Odoo has proven its capacity and robust quality in terms of helping businesses
How Can Odoo Module Customization Revolutionize Your Purchase Management Workflow
How Can Odoo Module Customization Revolutionize Your Purchase Management Workflow?
Odoo is famous for its customizable nature. Businesses from around the world choose Odoo because of its scalability and modality. Regardless of the business size, Odoo can cater to the unique and diverse needs of any company. Odoo has proven its capacity and robust quality in terms of helping businesses
How to Use Salesforce Experience Cloud to Create a Community That Matches Your Brand
How to Use Salesforce Experience Cloud to Create a Community That Matches Your Brand
Salesforce Experience Cloud is a robust platform that enables you to create engaging and personalized customer portals for your business. Whether a small startup or a large enterprise, you can create a customer portal in Salesforce Experience Cloud to enhance customer relationship management and deliver a seamless and satisfying customer

          Success!!

          Keep an eye on your inbox for the PDF, it's on its way!

          If you don't see it in your inbox, don't forget to give your junk folder a quick peek. Just in case.



              You have successfully subscribed to the newsletter

              There was an error while trying to send your request. Please try again.

              Zehntech will use the information you provide on this form to be in touch with you and to provide updates and marketing.