How to deal with component with async and sync possbilities? #279
-
Lets say I have a component have both sync and async ability, what is the best practice to organize this component, should I separate them into two component? like |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
If they do very different things (and use different third-party dependencies) behind the functions, then it could be good to separate them into different components. If it is the same basic functionality in both of them, it could be a good thing to have them in the same component. Or even extract some of the shared code into separate component(s) too (smaller LEGO bricks). In short, it depends 😄 (sorry) If you keep the components small, then it shouldn't be too much work changing them to separate/combined if it turns out it was the wrong decision. |
Beta Was this translation helpful? Give feedback.
If they do very different things (and use different third-party dependencies) behind the functions, then it could be good to separate them into different components. If it is the same basic functionality in both of them, it could be a good thing to have them in the same component. Or even extract some of the shared code into separate component(s) too (smaller LEGO bricks).
In short, it depends 😄 (sorry)
If you keep the components small, then it shouldn't be too much work changing them to separate/combined if it turns out it was the wrong decision.