-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Labels
enhancementNew feature or requestNew feature or requesthelp wantedExtra attention is neededExtra attention is needed
Description
If someone writes a useCoolMemo hook which has a similar signature of useMemo, there should be a generic macro which gives access to the inputs array. A proposed syntax is:
import { auto } from 'hooks.macro';
useCoolMemo(someOtherArg, ...auto(() => x * y));Which could become:
useCoolMemo(someOtherArg, ...[
() => x * y,
[x, y]
]);Special cases
We could also treat some special cases in a different way for performance reasons.
Array destructuring
const [ impl, inputs ] = auto(() => x * y);Becomes:
const impl = () => x * y;
const inputs = [x, y];Arguments spread
useSomething(...auto(() => x * y));Becomes:
useSomething(() => x * y, [x, y]);Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requesthelp wantedExtra attention is neededExtra attention is needed