Create a new component in a Sitecore-first JSS app running in connected mode
When developing Sitecore-first, if you are running the application in connected mode, you can deploy a component registration to your Sitecore instance.
To create a component in the Sitecore-first development workflow in a JSS Next.js app refer to Walkthrough: Create a new component in a JSS Next.js app using the Sitecore-first development workflow.
The following steps apply to React, Angular, or Vue.js JSS applications.
To create a new component when the application is running in connected mode:
-
Determine the placeholder name that the component needs to live in. This placeholder name must be defined in a component's JavaScript code (root or another component) to determine where the component is injected in the HTML source code.
-
Use the command
jss deploy component
to deploy the component's registration to the Sitecore database.RequestResponsejss deploy component <ComponentName> --allowedPlaceholders=[placeholderName]
-
Create the component in the JSS app and register it in the Component Factory.
-
Deploy the app's build artifacts to Sitecore:
RequestResponsejss deploy files
-
Log in to Sitecore and open a route on the app with one of the supported Sitecore editors. Then, add your new component to its allowed placeholder from the UI.