I am actually looking for a sample.
N/A
I am about to implement PnPjs in a SPFx Client Side Web Part. Among all the samples, would you have one specifically to recommend as template?
I found an example of implementation as a service in React-AdaptiveCards-Hooks. It looks very nice and I plan to shamelessly copy/paste it. But before I do so, I'd be interested to know if there are other recommendations.
Thanks for your time!
Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.
I did some more research on the site on how to implement SP REST services... and came up with more questions.
Note, I a m not trying to get an absolute answer on what is best, I am just trying to make sense of what I find here, and possibly give a hand to do some cleanup.
So I found two locations that implement a SP service, using @microsoft/sp-http rather than PnPjs:
https://github.com/pnp/sp-dev-fx-property-controls/tree/master/src/services
https://github.com/pnp/sp-dev-fx-controls-react/tree/master/src/services
Is there any reason why those two folders are different? Would it make sense to converge to a same folder? I could take this on, but again I am trying to understand what's going on first.
Hey @PathToSharePoint the two locations you are referring to are two completely separate repositories -- which are intended to generate different NPM libraries.
While the code might appear to be similar, it is purposely maintained separately to keep the respective bundle sizes small. One might want to include only one or the other library, without having to include both.
This link will take you to a complete list of current samples which use sp-http. Take a look and let us know if you still need someone to volunteer to create sample.
Thanks @hugoabernier ! I didn't think about searching for "sp-http" 馃槄
I am clear about those being two separate repositories. I was just wondering why the sp-http services sub-folder - which exists in both - would be different. And the reason I am asking is that at some point I might build a third repository (with function components), with yet another "services" folder to support sp-http.
I was not looking for a new sample, just trying to get more information on what already exists. So I think I have my answers, and I'll just go ahead and close the thread. Thanks for the reply!