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

Function Example

packages/react-aria/test/utils/useObjectRef.test.js:92–108  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

90 });
91
92 const Example = () => {
93 const outerRef = React.useRef();
94
95 /**
96 * Order of the following should not matter. So, even though the first
97 * component has a "Bar" placeholder, both will end up having the same
98 * placeholder text "Foo" because `outerRef` was forwarded to
99 * `LeaderTextField` and got updated by `useObjectRef` before
100 * `FollowerTextField` executed its `useEffect`.
101 */
102 return (
103 <>
104 <FollowerTextField placeholder="Bar" ref={outerRef} />
105 <LeaderTextField placeholder="Foo" ref={outerRef} />
106 </>
107 );
108 };
109
110 render(<Example />);
111

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected