3.9.3. Admin Development Constraints

This chapter lists some constraints of admin widgets and UI routes.

Arrow Functions#

Widget and UI route components must be created as arrow functions.

Code
1// Don't2function ProductWidget() {3  // ...4}5
6// Do7const ProductWidget = () => {8  // ...9}

Widget Zone#

A widget zone's value must be wrapped in double or single quotes. It can't be a template literal or a variable.

Code
1// Don't2export const config = defineWidgetConfig({3  zone: `product.details.before`,4})5
6// Don't7const ZONE = "product.details.after"8export const config = defineWidgetConfig({9  zone: ZONE,10})11
12// Do13export const config = defineWidgetConfig({14  zone: "product.details.before",15})
Was this chapter helpful?
Edit this page