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

Function apply

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

Source from the content-addressed store, hash-verified

122
123 let nextValue = useRef<TokenFieldValue | null>(null);
124 let apply = (fn: (value: TokenFieldValue) => TokenFieldValue) => {
125 state.setValue(value => {
126 let newValue = fn(value);
127 nextValue.current = newValue;
128 return newValue;
129 });
130 };
131
132 // Composition events are not cancelable. The browser will mutate the DOM, making it out of sync with React.
133 // 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