Skip to main content

Implement SPFx component with ReactJS in few Steps


The web part is running on the browser that runs in the context of a SharePoint page.

And required only clients side scripting languages to make it run.

It can be deployed to SharePoint environments that support the SharePoint Framework. You can also use modern JavaScript web frameworks, to build them.

Support:

  • It can be built with HTML and JavaScript with a specific framework.

  •  It supports SharePoint Online and on-premises.

 

Create a new web part using Visual Studio Code to

Below are the step

  • Go to the Open folder by clicking on the File section

  • Create a folder and open it.      

  • Click into the terminal and select new terminal 
  • Write the script there in the new terminal
Yo @microsoft/Sharepoint
  • You see at the terminal window, a new promote open, here you need to give a  new for the solution, in my case I give It the name HelloLife.
                         



  • Then it will ask you to select the folder

  • Then showing, in my case I select N
                           


   Then again, I select N

   Now the things are almost done, now, you got three options

  • WebPart 
  • Extension
  • Library

    So, now we select the first option, to create WebPart           



Now the new screen appearing and saying to select one of the frameworks from default there office 365 give the freedom to developers to choose any of the frameworks from default or you can select No JavaScript framework. 

after selecting and pressing enter it will start the process of downloading all the required packages and library’s, it will take some time to download

Once it is completed, a new screen appears, now you can see the complete structure of the solution, in the below images

Inside the src/components folder, you can get the file structure name as we gave to the component name 




 Now, all is done and need to run some more command by opening the terminal window

 gulp build (Used to build the structure)
 gulp serve (to start the server)

After the server going to start, on the terminal a screen showing lines of text and open a web page with localhost workbench.

Here you can see, our web part appearing on the new web part area







So, this is the very basic of SPFx, I hope you get it informative, In the next post, I will tell you how we can add custom logic inside the web parts.

 

 



Comments

Popular posts from this blog

Power Apps modern driven app Interview Question and answer

Question 1: What is a Power Apps modern driven app? Answer: A Power Apps modern driven app is a low-code/no-code application development platform provided by Microsoft. It allows users to create custom applications that can run on various devices and platforms without the need for extensive coding. These apps can be built using a visual interface and can integrate with different data sources. Question 2: What are the key components of a Power Apps modern driven app? Answer: The key components of a Power Apps modern driven app are: Screens : Screens serve as the user interface for the app and can include multiple layouts, controls, and data visualizations. Data sources : These are the various repositories where the app can retrieve and store data, such as SharePoint lists, SQL databases, Excel files, etc. Connectors : Connectors enable integration with external services and systems, allowing data to be fetched or updated. Formulas : Power Apps uses a formula language called Power Apps ...

Interview Questions of SPFx SharePoint

What is SPFx? The SharePoint Framework (SPFx) is a web part model that provides full support for client-side SharePoint development, it is easy to integrate with SharePoint data, and extend Microsoft Teams. With the SharePoint Framework, you can use modern web technologies and tools in your preferred development environment to build productive experiences and apps that are responsive and mobile-ready. Scenario Based asking Scenario 1: Scenario: Your team is developing a SharePoint Framework (SPFx) web part that needs to retrieve data from an external API and display it on a SharePoint site. The API requires authentication using OAuth 2.0. The web part should also allow users to refresh the data manually. Question 1: How would you approach implementing this functionality in an SPFx web...

SPFX Interview question for 2023

SPFx Interview Questions for 2023 Question 1: What is SharePoint Framework (SPFx)? Answer: SharePoint Framework (SPFx) is a development model introduced by Microsoft for creating client-side web parts and extensions for SharePoint Online and SharePoint 2019. It is based on modern web technologies like JavaScript, TypeScript, and React, providing a rich and responsive user experience. Question 2: What are the key advantages of using SPFx for SharePoint development? Answer: SPFx offers several advantages, such as: Responsive and mobile-ready web parts and extensions. Seamless integration with SharePoint data and services. Support for modern web development practices and tools. Easy deployment and hosting options. Enhanced security and isolation through the SharePoint app model. Question 3: Can you explain the structure of an SPFx solution? Answer: An SPFx solution consists of the following key components: Web Parts: These are the building blocks of SPFx solutions, representing the vi...