We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a0d485c commit bbc5c98Copy full SHA for bbc5c98
1 file changed
src/control.js
@@ -84,10 +84,11 @@ export function controlEqual(prev, next) {
84
85
export function useThru(control, interceptor) {
86
const ctrl = useNewControl(control);
87
- const {state, useState} = ctrl;
88
- if (Object.getPrototypeOf(ctrl).state) {
89
- ctrl.state = interceptor(state);
+ const parentState = Object.getPrototypeOf(ctrl).state;
+ if (parentState) {
+ ctrl.state = interceptor(parentState);
90
} else {
91
+ const {useState} = ctrl;
92
ctrl.useState = (...params) => interceptor(useState(...params));
93
}
94
return ctrl;
0 commit comments