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

Function hydrate

src/server/pure.ts:28–38  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

26 }
27 },
28 hydrate() {
29 if (container) {
30 throw new Error('The component can only be hydrated once')
31 } else {
32 container = document.createElement('div')
33 container.innerHTML = serverOutput
34 act(() => {
35 ReactDOM.hydrate(testHarness(renderProps), container!)
36 })
37 }
38 },
39 rerender(props?: TProps) {
40 if (!container) {
41 throw new Error('You must hydrate the component before you can rerender')

Callers 6

useEffect.test.tsFile · 0.85
cleanup.test.tsFile · 0.85
renderHookFunction · 0.85

Calls 1

testHarnessFunction · 0.85

Tested by 1

renderHookFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…