MCPcopy Create free account
hub / github.com/adobe/react-spectrum / apply

Function apply

packages/react-aria/src/tokenfield/useTokenField.ts:125–131  ·  view source on GitHub ↗
(fn: (value: TokenFieldValue) => TokenFieldValue)

Source from the content-addressed store, hash-verified

123
124 let nextValue = useRef<TokenFieldValue | null>(null);
125 let apply = (fn: (value: TokenFieldValue) => TokenFieldValue) => {
126 state.setValue(value => {
127 let newValue = fn(value);
128 nextValue.current = newValue;
129 return newValue;
130 });
131 };
132
133 // Composition events are not cancelable. The browser will mutate the DOM, making it out of sync with React.
134 // To account for this, we prevent React from re-rendering during composition, and track DOM mutations performed

Callers 2

useTokenFieldFunction · 0.85
writeClipboardDataFunction · 0.85

Calls 2

fnFunction · 0.85
setValueMethod · 0.65

Tested by

no test coverage detected