use-state-with-callback
use-state-with-callback copied to clipboard
Make lazy callback function non mandatory
When using a form I want to set a value for a state. i.e setValue("myvalue"). In that case I dont want to trigger anything after value change.
But in some cases I would like to setValue and use the callback.
So I guess this: type DispatchWithCallback<A, S> = ( value: A, callback: Callback<S>, ) => void;
should be this:
type DispatchWithCallback<A, S> = ( value: A, callback?: Callback<S>, ) => void;