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
{{ message }}
This repository was archived by the owner on Dec 16, 2025. It is now read-only.
Repository navigation
This repository was archived by the owner on Dec 16, 2025. It is now read-only.
A new pattern (not a pattern actually a necessity), if a component does more than one things (ignore UNIX, since countably), it will have multiple internal states. If some, it's onChange handlers should give the state setter back (in addition to event), and second, have a prop that omits setting of state of the component.
Example: a tab component has two things, the tab state, and the content state. I experienced an issue once, where the person did some work in one content, and clicked other tab, so we showed a modal with 'cancel' and 'discard'. i.e. we need the click event, but want to capture control and defer the state change. Simplest possible approach is for the Tab component to pass the setter to us. This way we can add a flow, and defer the action whenever we want.
Of course, we'll need to pass a prop to avoid state calls, and use this onClickSafe event.
Simple.
conclusion
a general way to defer internal flow of one component, and getting control of that flow via the feature component.
name
"Delegate action pattern", or "add your flow in the middle"
Activity