How I understood was that, one should specify "what" (declarative) a component should do not "how" (imperative) it should do.
So in the Switch example, onClick specifies "how" a user should interact with it, while onChange exposes a general behavior of "what" the component can do.
Would you correct my understanding as I could be getting the whole abstraction wrong 😅
Thank you, Sid. It was very helpful 👋.
How I understood was that, one should specify "what" (declarative) a component should do not "how" (imperative) it should do.
So in the
Switchexample,onClickspecifies "how" a user should interact with it, whileonChangeexposes a general behavior of "what" the component can do.Would you correct my understanding as I could be getting the whole abstraction wrong 😅
That's the perfect way of looking at it!
😄👊