diff --git a/__tests__/dom-to-react.test.tsx b/__tests__/dom-to-react.test.tsx index 3add2a40..e99509df 100644 --- a/__tests__/dom-to-react.test.tsx +++ b/__tests__/dom-to-react.test.tsx @@ -84,7 +84,7 @@ describe('domToReact', () => { it('does not have `children` for void elements', () => { const reactElement = domToReact(htmlToDOM(html.img)) as JSX.Element; - expect(reactElement.props.children).toBe(null); + expect(reactElement.props.children).toBe(undefined); }); it('does not throw an error for void elements', () => { diff --git a/src/dom-to-react.ts b/src/dom-to-react.ts index 01eb41f6..70780e65 100644 --- a/src/dom-to-react.ts +++ b/src/dom-to-react.ts @@ -96,7 +96,7 @@ export default function domToReact( props = attributesToProps(element.attribs, element.name); } - let children = null; + let children; switch (node.type) { case 'script':