I am going to develop one JSS app in Sitecore. Before starting, what are best practices must follow? What are naming considerations should follow for placeholder in any JSS app?
Placeholder principles work exactly the same in the regular Sitecore and in the newer Sitecore JSS framework. So I think it can be common questions about what are the best practices must follow for Sitecore placeholder.
I guess this can be an architect level decision to follow the placeholder name standard but I think below is a good approach -
- meaningful name
- every character in lowercase
- no space and camelcase
- use "-" if required i.e.
- try to avoid the same placeholder key if possible
Placeholders defined in JSS will use the global
keyfield on their Placeholder Settings. This means that conflicts may arise if non-JSS and JSS apps use the same placeholder key on a multi-site Sitecore installation. This is not a JSS-specific issue, and to avoid it give JSS apps unique placeholder names such as
myapp-main. Note that JSS apps will not
conflictwith each other when using the same placeholder keys, if there are multiple JSS sites.