Forum Discussion
Akhil_Arelli1309
Mar 16, 2020Copper Contributor
How to deploy a React application into Sharepoint Online?
I created a sample React application running in http://localhost:3000/ . Now this application should run within sharepoint. what is the procedure? can any one suggest a solution.
11 Replies
Sort By
- sandeshinikkamCopper Contributor
How to store the upload file from react application to sharepoint?where i dont want the access token to be there and directly store the file in the sharpoint in simple code?
- chariotlilyCopper ContributorOMG I am so sorry to bother after 2 years but this is exactly what I'm trying to do right now. Do you mind share how it goes? Are you able to run react app within sharepoint? Thank you!
- ntnbnslCopper Contributor
By any chance, if guys reach to any solution??
- xomrayCopper Contributor
ntnbnsl -- I found a workaround. Just 'npm run build' and take the contents of that build folder and drop into a folder on Sharepoint. That folder should include any static files and your root html page. Note: in your package.json file, your homepage (i think) matters. try ".", or try the url path of the SHarepoint folder the files live in. I fumbled through this workaround, but works okay for me.
Now, everytime you want to make changes to the site, you will need to rebuld the site and drag/drop/replace those files in the Sharepoint folder.
- vcimaCopper ContributorHi Akhil,
You have to obtain the app, for example in my case, I have used this comands:
gulp clean
gulp build
gulp bunde --ship
gulp package-solution --ship
After this, you will have a .sppkg file.
You must leave this file in the catalog of your SharePoint:
https://xxxxxxxxxxxxxx-admin.sharepoint.com/ > More features > Apps > App catalog
Once the file is part of the catalog, set the app rights and after that go to the your sharepoint page > Settings > Add an app > Select this app
And thats all, following this steps a new component will appear with your app.- Akhil_Arelli1309Copper Contributor
vcima The React application we are running is NPM builded. will this support "gulp".
- vcimaCopper Contributor
The most important is to create the file: .sppkg, obviously the way to create this file depends on your tools.In my case I have developed the component with yeoman, I have followed this steps:
Regards!
- kkopiecCopper Contributor
Hi, It all depends on what development model did you take.
The 2 most common are Provider Hosted Application and SPFx.
Provider hosted is generally a web app with access to SharePoint, SPFx takes the form of webparts and customizations to modern SharePoint experience pages, and is usually entirely client-side based.
https://docs.microsoft.com/en-us/sharepoint/dev/spfx/web-parts/get-started/build-a-hello-world-web-part
https://docs.microsoft.com/en-us/sharepoint/dev/sp-add-ins/get-started-creating-provider-hosted-sharepoint-add-ins
regards
Karol - Can you elaborate more on what you are trying to achieve? By the way, take a look at SharePoint Framework, the recommended development model for SharePoint Online
- Akhil_Arelli1309Copper Contributor
jcgonzalezmartin In local folder(Pc or VisualStudio code) we created a sample(Search functionality) React JS Application. Its running in Localhost server. Now we need some data points on how we can host this External application within Sharepoint.
- You cannot host a React App in SPO in the way it seems you want. You have two options here:
- Rebuild your App as a SPFx Solution (Recommended)
- Rebuild your App as a SPO Add-in (Not recommended)