You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#330 touched on this subject but the solution there doesn't really work if you have multiple data sources.
For example, what I'm working on right now, has state for Quotes and Orders. Both have Products and all the logic associated with Products is identical between them.
It would be convenient if atomFamily (or a new util) accepted an optional, non-memoized, value to be used for initialization:
exportconstproducts=atomFamily({key: 'products',default: (key,value)=>{letout=[]value.forEach((v,i)=>{constrkey=`${key}/product/${i}`// create individual atoms for the mutable fieldsproductQuantity(rkey,v.quantity)productPrice(rkey,v.price)// add rkey to each product for later referenceout.push({ ...v, rkey })})returnout}})
Here's a simplified overview of what I'm doing now:
#330 touched on this subject but the solution there doesn't really work if you have multiple data sources.
For example, what I'm working on right now, has state for Quotes and Orders. Both have Products and all the logic associated with Products is identical between them.
It would be convenient if atomFamily (or a new util) accepted an optional, non-memoized, value to be used for initialization:
Here's a simplified overview of what I'm doing now:
The text was updated successfully, but these errors were encountered: