adobe / aem-project-archetype

Maven template to create best-practice websites on AEM.
https://experienceleague.adobe.com/docs/experience-manager-core-components/using/developing/archetype/overview.html
Apache License 2.0
544 stars 419 forks source link

New Frontend Module: React Web Components (non SPA) #898

Open mkovacek opened 2 years ago

mkovacek commented 2 years ago

Would be nice to have an option to generate the project with a frontend module that follows react web components approach (non SPA)

Two options:

  1. Extension of general frontend module so that we can still use existing approach for standard content components + react web components approach for specific, frontend complex components.
  2. Only react web components approach

https://github.com/adobe/react-webcomponent https://github.com/adobe/aem-react-core-wcm-components-examples/tree/master/react-webcomponents-example-project

kevinolivar commented 2 years ago

Hi there,

Sorry for the late reply and not sure if you managed to find an answer or not but maybe this can help. I setup an AEM project (not headless, nor spa) with the general frontend module and the following 'requirements' in mind:

For core components, we just need styling. For custom components, it depends if we need interactivity or not. If yes we go vanillaJS or alpineJS. If not, no problem we go HTL. For complex components, we go 100% react.

For this last point, I am using this library https://github.com/bltnico/react-register-dom which also helps handling SSR. There was another library which needed you to set a model and so on, but it was too cumbersome. I cannot recall the name.

mkovacek commented 2 years ago

Hi, yea I managed it. I used react spa frontend type and just update dependencies (removed spa-related and included react-webcomponent ones)

kevinolivar commented 2 years ago

Hi,

ah cool then! Would you have a 'demo' repo? Just curious about what you got.

Thanks!

mkovacek commented 2 years ago

Hi, I have forgot about it.

Here is demo example: https://github.com/mkovacek/aem-react-webcomponents