Working with JSS in Connected Mode
To create a new component in connected mode:
- Determine the placeholder name that the component needs to live in (this placeholder name must be defined in the app root JS or another component's JS, to define where in the HTML source the component will be injected)
- Use the
jss deploy component <componentName> --allowedPlaceholders=[placeholderName]command to deploy the component's registration to the Sitecore database. This command can also specify data fields that the component needs; use
jss deploy component --helpfor details.
- Create the component in the JSS app (this is JS-library-specific; e.g. for React, create a React component and register it with the
- Deploy the JSS app's build to Sitecore (integrated mode is necessary here so that we can use Experience Editor to add the component to a route).
jss deploy fileswill do this for any app.
- Login to Sitecore and open a route on the app with the Experience Editor. You should be able to add your new component to its allowed placeholder from the UI.