AEM - React Implementation for the AEM Core Components
npm install @adobe/aem-core-components-react-baseThis module provides a React implementation for the AEM core components.
This enables you to use the core components:
-In the AEM SPA editor with React
-In React web components
-Or in any other React context, provided you have the input needed to instantiate the components.
Current supported / exported components:
You can choose to import the entire library at once OR import components individually.
The latter is useful if you want to only enable a few components and you want to save your javascript footprint.
Also, if you want to load all core components, but you want to lazyload them with react suspense, you will need to import them individually.
```
import * as BaseCoreComponents from "@adobe/aem-core-components-react-base";
const {ButtonV1, ButtonV1Model, ButtonV1IsEmptyFn} = BaseCoreComponents;
import ButtonV1, {ButtonV1Model, ButtonV1IsEmptyFn} from "@adobe/aem-core-components-react-base/dist/authoring/button/v1/ButtonV1";
`$3
Now that you have the Button and ButtonV1IsEmptyFn imported, you can use them in your project.
The properties of the Button 1 on 1 correspond to the Sling Model Exporter (.model.json) output.
Note: There are some exceptions where some extra properties are added (mainly i18n labels) that are currently not present in the OOTB sling model exports.
These can be added by the project itself with delegation. If they are not present, the default (English) values will be used.
#### Button - Direct instantiation with TypeScript:
`
const modelProps:ButtonV1Model = {
text: 'Example Button',
link: '/content/my/awesome/page.html',
icon: 'iconCssCLass'
};const html:JSX.Element = ( );
`
#### Button - Example with the spa editor:
`
MapTo('my-project/wcm/components/button')(ButtonV1, {isEmpty: ButtonV1IsEmptyFn});
``For a complete project with examples, visit the github page.