-
Notifications
You must be signed in to change notification settings - Fork 102
Open
Description
Line 4 in d0a2daa
| export type DraftFunction<S> = (draft: Draft<S>) => void; |
It currently specifies void as the return type, but you can actually return a new object, like:
const [state, updateState] = useImmer({ some: "value" });
updateState(() => ({ new: "value" }));From my observations, it's equivalent to:
updateState({ new: "value" });I was trying to make a wrapper for the updater function and the wrong function signature tripped me up.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels