Skip to content

Commit

Permalink
fix(dom-to-react): default props.children to undefined instead of null
Browse files Browse the repository at this point in the history
  • Loading branch information
remarkablemark committed Oct 29, 2023
1 parent 57571aa commit a6978c3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion __tests__/dom-to-react.test.tsx
Expand Up @@ -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', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/dom-to-react.ts
Expand Up @@ -96,7 +96,7 @@ export default function domToReact(
props = attributesToProps(element.attribs, element.name);
}

let children = null;
let children;

switch (node.type) {
case 'script':
Expand Down

0 comments on commit a6978c3

Please sign in to comment.