MCPcopy
hub / github.com/preactjs/preact / TestComponent

Function TestComponent

debug/test/browser/validateHookArgs.test.jsx:22–31  ·  view source on GitHub ↗
({ initialValue })

Source from the content-addressed store, hash-verified

20 */
21 function validateHook(name, hook) {
22 const TestComponent = ({ initialValue }) => {
23 const [value, setValue] = useState(initialValue);
24 hook(value);
25
26 return (
27 <button type="button" onClick={() => setValue(NaN)}>
28 Set to NaN
29 </button>
30 );
31 };
32
33 it(`should error if ${name} is mounted with NaN as an argument`, async () => {
34 render(<TestComponent initialValue={NaN} />, scratch);

Callers

nothing calls this directly

Calls 2

useStateFunction · 0.90
setValueFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…