Hi All,
Last year i did lot of research and hands on to "XM Cloud Component Builder", Very powerful futuristic tooling provided by Sitecore.
At that time it was still in "Early Access" phase.
You can have a look at my "SUGCON 2023 - Presentation on XM Cloud Component Builder" to know about it's capabilities and use cases.
and if you are PODCAST lover, find the podcast here
There are three options I have personally configured and work like a charm.
1) If you have XM Cloud Starter Kit Repo and XM Cloud Project already, it has seamless support where you can just do certain configurations and your react/NextJS components which are in XM Cloud StarterKit code will come to life in component builder, we will see the steps later in this blog
2) If you have existing NextJS components already, you can bring those components straight to your builder & start using them on "Pages".
3) If you have existing react components already, you can bring those components straight to your builder & start using them on "Pages".
You can bifurcate these approaches in two broader categories.
1) Using an existing rendering host of XM Cloud - When your components are made part of XM Cloud Startkit which you are already using, in that case you do not require to add any external rendering host, XM Cloud default rendering host will take care of it.
2) Using "External Rendering Host" - In cases where your react/NextJS components are already residing in some other source control and live on some other sites and which you want to bring into XM Cloud component builder, Here it needs the live URL of the site to be configured into XM Cloud, If the components are configured correctly (which I will show you in this blog), XM Cloud will read those components too.
What are the steps?
Ok, Let's talk about the steps first,
1) If you are trying to use your react or NextJS components to be made available, then first you will need to install below in your code repo
npm install @sitecore-feaas/clientside
2) Go to your component which you want to import and write below line
/* eg. src/components/MyComponent.js */
import * as FEAAS from "@sitecore-feaas/clientside/react"
3) You will need to register the component
Remember BYOC support is out of the box for XM Clodud Starter repo, above steps are only for if you want your existing NextJS component to be registered and available in XMC as external rendering host
I think it is very powerful way of working where you can just Bring Your Code in and it just works, That means you do not have to rewrite those components for xm cloud but you will be able to see those components exactly like your current react site and will be able to drag & drop them on the pages
Reference - Walkthrough: Registering an external React component | Sitecore Documentation
Comments
Post a Comment