Domanda

We have an on-prem Sharepoint 2016 server which has been kept up to date with the latest security and feature updates and patches.

We want to build a client application using SPFx Web parts, particularly interested in React. If I use the current scaffolding generator (1.7), it asks if I want to target Sharepoint 2016 and onward, along with 2019 onward, and simply just Online.

If we select the Sharepoint 2016 option, we get React 15.4 along with "@microsoft/sp" libraries locked to 1.1.x .

If we select the 2019 onward option, then we get React 16.3 along with "@microsoft/sp" libraries locked to 1.7.x .

I'd like to use the latest React features such as the context API and etc when building these webparts, is it possible to deploy the solution built with 2019 onward option onto Sharepoint 2016 ?

If not, can I update my React version in package.json to 16+ while selecting the Sharepoint 2016 scaffolding option ? I know I've seen "@microsoft/sp" and "@microsoft/sp-office-ui-fabric-core" libraries that aid in building webparts use the React that is available in your application. Don't really know if they would break.

Has anyone tried this ?

È stato utile?

Soluzione

Small correction in your data: if you select SharePoint 2019 and onwards, you will receive 1.4.x version of @microsoft/sp*.

To your question, technically you can upgrade the version of react in your solution, however, it might lead to unpredictable situations in the future:
- imagine you created V1.0 of a web part and all works fine. Now you have a need to add new features. And those new features don't work with React 16 and SPFx 1.1 for some reason (SP 2016). How will you solve that?
- what if Microsoft will issue an update to 1.4 for SP 2016 and it will break your web part?

Taking everything above into account my recommendation is to stick with supported versions.

Altri suggerimenti

You can't upgrade the version of react in your solution, only SPFx 1.1 is supported in SP2016 on-premises & React is pinned to v15.4.2.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a sharepoint.stackexchange
scroll top