I try to update zustand state use set timeout without other hooks
const useCustom = create(set => ({
isAction: false,
onAction: value =>
set(prev => {
return { isAction: true };
setTimeout(() => {
return { isAction: false };
}, 100);
}),
}));
Is there a solution for this?
If you set
setTimeout
in this way , it should work as you expect