Can pages, widgets has own stores for business logic? #731
-
TLDR: Should features layer be only place domain logic locate Rather than using features layer, can we locate stores including business logic like transform request payloads, validation in pages or widget? There were some cases skipping widget layer, only pages layer remains which has components segment in there, and stores would be used in somewhere in these components. For me |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Widgets and pages certainly can have business logic and stores — there's no rule that forbids it. However, usually, pages are not the right scope for a store. A store is usually global (used on several pages) or local to a certain component, so it might just be placed next to that component. You can certainly start by having a model segment on a page, and maybe later move it to another layer if the project requirements need it |
Beta Was this translation helpful? Give feedback.
Widgets and pages certainly can have business logic and stores — there's no rule that forbids it.
However, usually, pages are not the right scope for a store. A store is usually global (used on several pages) or local to a certain component, so it might just be placed next to that component.
You can certainly start by having a model segment on a page, and maybe later move it to another layer if the project requirements need it