ACM Editorial · 2026-11-28 · 1 min read

Create components for reusable table, form-field and modal behaviours, but keep business rules in shared services.

Define component boundaries

Create components for reusable table, form-field and modal behaviours, but keep business rules in shared services. Use props for inputs and events for communication. Avoid hidden dependencies that make a component usable only in one page.

Derive instead of duplicating state

A total can be a computed value based on line items; duplicating it in several mutable properties makes mismatches likely. Use a single source for filters and selection state. Keep authoritative amounts calculated on the server.

Render data safely

Use normal interpolation for user-supplied text. Raw HTML requires strict sanitisation and a clear reason. Treat URLs, uploads and permission decisions as server concerns, not something the component can guarantee.

Review the lifecycle

Handle a slow or failed request without leaving the screen frozen. Preserve draft fields on errors and remove subscriptions when a component is destroyed. Use tests to check reusable components and a small number of complete user flows.

Further reading

https://vuejs.org/guide/introduction.html