Does anyone have any working examples of an AEM project structure that leverages AEM's SPA editor with Redux to manage global state between components? If someone can provide me an example I can probably reverse engineer it to figure out what is wrong with my project...
I've initialised a project structure following the AEM archetype with the frontend module set to React. I've setup Redux in the usual manner wrapping my <App> component within index.jsx in the <Provider> from react-redux passing in the store. Everything works fine when I run my app using the local dev server or when I "View as Published" from AEM author. I do however seem to get the following error when viewing a page that references an AEM component mapped to a React Component that calls the useDispatch() hook. Shared.js seems to be some Granite related script.
Uncaught TypeError: Cannot read properties of undefined (reading 'setParameter')
at Object.noCaching (shared.js:561:28)
at Object.load (shared.js:2744:34)
at HTMLDocument.<anonymous> (core.js:1046:26)
at HTMLDocument.dispatch (jquery.js:5232:27)
at elemData.handle (jquery.js:4884:28)
at Object.trigger (jquery.js:5136:12)
at HTMLDocument.<anonymous> (jquery.js:5866:17)
at Function.each (jquery.js:371:19)
at jQuery.fn.init.each (jquery.js:137:17)
at jQuery.fn.init.trigger (jquery.js:5865:15)
Any advice from anyone that's used Redux on an AEM SPA Editor enabled site would be appreciated as well.
Thanks