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

Function apply

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

Source from the content-addressed store, hash-verified

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