We have a Next.js application which uses Storybook as a component library.
I am having issues when using the usePiwikPro() hook in React components which are used in Storybook stories. Adding PiwikPro to my components effectively breaks the Storybook stories in which they are used. I have tried implementing a decorator to wrap all my stories in the PiwikProProvider, but I keep getting the same error (see below). Furthermore I have tried using storybook addons to mock out PiwikPro, but I had no luck making this work.
TypeError: Cannot read properties of null (reading 'useContext') at useContext (http://localhost:6006/vendors-node_modules_babel_runtime_helpers_esm_classCallCheck_js-node_modules_babel_runtime_h-ed3419.iframe.bundle.js:2421:21) at usePiwikPro (http://localhost:6006/vendors-node_modules_babel_runtime_helpers_esm_classCallCheck_js-node_modules_babel_runtime_h-ed3419.iframe.bundle.js:103:61)