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
Ask Anything
FAQ
What is Medusa?
How can I create a module?
How can I create a data model?
How do I create a workflow?
How can I extend a data model in the Product Module?
Recipes
How do I build a marketplace with Medusa?
How do I build digital products with Medusa?
How do I build subscription-based purchases with Medusa?
What other recipes are available in the Medusa documentation?
Chat is cleared on refresh
Line break