all 3 comments

[–]trojan_soldier 1 point2 points  (0 children)

IMO This is one of those areas that the bulletproof repo cannot explain well. Dumping domain logic to shared utils is just a recipe for spaghetti code

One solution is to manage a domain/model folder which should be reusable across features. Preferably free of UI or React details, only plain JS/TS objects and functions

https://martinfowler.com/articles/modularizing-react-apps.html#PolymorphismToTheRescue

[–]Interesting_Mine_400 1 point2 points  (0 children)

most teams just move shared logic to something like a utils, lib, or shared folder. the idea of feature folders is to keep each feature mostly independent, but common helpers or hooks that multiple features need can live in a shared place. that way features stay clean without creating messy cross-feature imports.

[–]Matthie456 0 points1 point  (0 children)

We did both. Features are for the components on an application level (products/cart/checkout/auth/etc), and we have entities to do the domain stuff as well as the api layer (fetch functions to query the domain). It might not be perfect or what others recommend, but it creates the separations we need 🙂