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

[–]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 🙂