Replies: 3 comments 1 reply
-
It depends on the use case. There is no strict rule. Can you give a concrete example, please? |
Beta Was this translation helpful? Give feedback.
-
@NetanelBasal thanks for your reply. Let's take a simple checkout page for example. There are 3 entities involved on the page, customer object (containing customer's info such as the stored addresses, credit card info etc ), shopping cart object (containing products array and total etc), and checkout page UI state object (containing selected payment method and other checkout info). In this case, do you recommend we put all these entities into one store or they should have separate stores? It would very helpful if you can give an example where we need to put multiple entities or mixed entities (data entity and UI entity) into one store. Thanks |
Beta Was this translation helpful? Give feedback.
-
Thanks for the example, I get the idea now. it's a matter of preference, not a pattern. I would still separate the product from the cart entity in the example :) , just to avoid using "ref: cartEntitiesRef" everywhere, also to prevent developers from forgetting to add ref in the select causing the wrong entity to be selected. |
Beta Was this translation helpful? Give feedback.
-
I am new to Elf and trying to understand the concept of putting one or more entities and UI entities into one store as documentation shown. In our projects, a UI page is normally constructed by multiple data entities. I would create separate stores for each data entity, also separate stores for each UI entity as needed, because they are separate concerns in my view. Can someone clarify when should I put data entities and UI entities into one store? what if the data entity is used by multiple UI pages,? Is there any drawback if I create a store per entity(regardless it's data entity or UI entity)?
Thanks in advance!
Beta Was this translation helpful? Give feedback.
All reactions