Replies: 1 comment
-
I don't think it's a typical use case, but something like this would be possible. Using JavaScript: const useStoreInternal = create()(set => ({
showChartNumbers: false,
updateChartNumbersVisibility: showChartNumbers => set({ showChartNumbers }),
})
);
export const useStore = (logger, selector) => {
const state = useStoreInternal(selector);
return new Proxy(state, {
get(target, prop) {
const value = target[prop];
if (typeof value === 'function') {
return (actionValue) => {
logger(prop, actionValue);
return value(actionValue);
};
}
return value;
},
});
}; Hmm, I don't think it's very useful and too complicated. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
So, in React component I want to do next:
I have such Store:
How to describe Store so it can take an external function as argument and pass some Store params inside the function ?
Beta Was this translation helpful? Give feedback.
All reactions