Replies: 4 comments
-
so what is best practice to organize actions in class. or just use object instead? |
Beta Was this translation helpful? Give feedback.
-
i think the object way might be something better..
if use valtio in this way, the consumer do not need to carry about the difference between proxy object and the snapshort object, just use the snap object |
Beta Was this translation helpful? Give feedback.
-
finally, i try to write class in this way
|
Beta Was this translation helpful? Give feedback.
-
I would avoid using snap in the state model. But if you find something works with your need, it's fine. |
Beta Was this translation helpful? Give feedback.
-
i use class to organize actions, it will throw two kinds of err.
first, i can not use arrow method in class, it can not trigger the snap get the lastest value when i call init method. but the snap will re-render with empty value {}. and i need to bind this to the class itself, because this will lost when business call init method directly
sencond, i need to use both proxy and snap in my code, because the snap will trigger error when calling init method to update the snap object's detail, which is frozen object. so i need to call proxy object like Service to run init method...
Beta Was this translation helpful? Give feedback.
All reactions