diff --git a/src/renderHookToSnapshotStream.ts b/src/renderHookToSnapshotStream.tsx similarity index 98% rename from src/renderHookToSnapshotStream.ts rename to src/renderHookToSnapshotStream.tsx index 90781ae03..b56138146 100644 --- a/src/renderHookToSnapshotStream.ts +++ b/src/renderHookToSnapshotStream.tsx @@ -3,7 +3,7 @@ import { createRenderStream } from "./renderStream/createRenderStream.js"; import type { NextRenderOptions } from "./renderStream/createRenderStream.js"; import { Render } from "./renderStream/Render.js"; -import { createElement } from "react"; +import { createElement } from "rehackt"; import { Assertable, assertableSymbol, markAssertable } from "./assertable.js"; export interface SnapshotStream extends Assertable { diff --git a/src/renderStream/createRenderStream.tsx b/src/renderStream/createRenderStream.tsx index 31f8f4044..54e67b81f 100644 --- a/src/renderStream/createRenderStream.tsx +++ b/src/renderStream/createRenderStream.tsx @@ -221,15 +221,12 @@ export function createRenderStream({ return baseRender(ui, { ...options, wrapper: (props) => { - let elem: React.ReactNode = React.createElement( - Wrapper, - undefined, - props.children + const ParentWrapper = options?.wrapper || React.Fragment; + return ( + + {props.children} + ); - if (options?.wrapper) { - elem = React.createElement(options.wrapper, undefined, elem); - } - return elem; }, }); }) as typeof baseRender; @@ -358,7 +355,7 @@ export function useTrackRenders({ name }: { name?: string } = {}) { if (!component) { throw new Error( - "useTrackRender: Unable to determine component. Please ensure the hook is called inside a rendered component or provide a `name` option." + "useTrackRenders: Unable to determine component. Please ensure the hook is called inside a rendered component or provide a `name` option." ); } @@ -366,7 +363,7 @@ export function useTrackRenders({ name }: { name?: string } = {}) { if (!ctx) { throw new Error( - "useTrackComponentRender: A Render Stream must be created and rendered to track component renders" + "useTrackRenders: A Render Stream must be created and rendered to track component renders" ); }