MCPcopy
hub / github.com/testing-library/react-hooks-testing-library / addCleanup

Function addCleanup

src/core/cleanup.ts:12–15  ·  view source on GitHub ↗
(callback: CleanupCallback)

Source from the content-addressed store, hash-verified

10}
11
12function addCleanup(callback: CleanupCallback) {
13 cleanupCallbacks = [callback, ...cleanupCallbacks]
14 return () => removeCleanup(callback)
15}
16
17function removeCleanup(callback: CleanupCallback) {
18 cleanupCallbacks = cleanupCallbacks.filter((cb) => cb !== callback)

Callers 2

renderHookFunction · 0.90
cleanup.test.tsFile · 0.85

Calls 1

removeCleanupFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…