From 212fb8f13ab65a6290bc3eb4510cc1218c5f8a5c Mon Sep 17 00:00:00 2001 From: Beau Cameron Date: Tue, 14 Feb 2023 06:52:46 -0700 Subject: [PATCH] Fix Context Conditional Better handling of truthy/falsy --- .../src/webparts/pnPjsExample/pnpjsConfig.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/react-pnp-js-hooks/src/webparts/pnPjsExample/pnpjsConfig.ts b/samples/react-pnp-js-hooks/src/webparts/pnPjsExample/pnpjsConfig.ts index 753d1c8ca..69b06b691 100644 --- a/samples/react-pnp-js-hooks/src/webparts/pnPjsExample/pnpjsConfig.ts +++ b/samples/react-pnp-js-hooks/src/webparts/pnPjsExample/pnpjsConfig.ts @@ -12,10 +12,10 @@ import "@pnp/sp/batching"; var _sp: SPFI = null; export const getSP = (context?: WebPartContext): SPFI => { - if (context != null) { + if (!!context) { //You must add the @pnp/logging package to include the PnPLogging behavior it is no longer a peer dependency // The LogLevel set's at what level a message will be written to the console _sp = spfi().using(SPFx(context)).using(PnPLogging(LogLevel.Warning)); } return _sp; -}; \ No newline at end of file +};