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; usejss deploy component --help
for 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
componentFactory.js
) - 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 files
will 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.