Repository: preactjs/preact-render-to-string (js)

Issue:
null is being removed when used as value in dangerouslySetInnerHTML html
Printing out `null` as the contents of an HTML text node through `dangerouslySetInnerHTML` activates the async renderer https://github.com/preactjs/preact-render-to-string/pull/333, and is removed from the output.

It used to be `undefined` but switched to `null` after this PR https://github.com/preactjs/preact-render-to-string/pull/339

E.g:

1. Correctly prints as text
```js
<p dangerouslySetInnerHTML={{ __html: undefined }} />
```

2. Activates async renderer indirectly and is removed from the output.
```js
<p dangerouslySetInnerHTML={{ __html: null }} />
```


Pull request description:
fix(core): render empty string for null __html
Fixes #346

This also got reported as an issue on Slack

Patch:
diff --git a/.changeset/yellow-ghosts-bow.md b/.changeset/yellow-ghosts-bow.md
new file mode 100644
index 0000000..58d53b5
--- /dev/null
+++ b/.changeset/yellow-ghosts-bow.md
@@ -0,0 +1,5 @@
+---
+'preact-render-to-string': patch
+---
+
+Correctly render `null` as an `__html` value as an empty string
diff --git a/src/index.js b/src/index.js
index 8c4ea39..9dec64a 100644
--- a/src/index.js
+++ b/src/index.js
@@ -55,7 +55,7 @@ export function renderToString(vnode, context, _rendererState) {
 	parent[CHILDREN] = [vnode];
 
 	try {
-		return _renderToString(
+		const rendered = _renderToString(
 			vnode,
 			context || EMPTY_OBJ,
 			false,
@@ -64,6 +64,11 @@ export function renderToString(vnode, context, _rendererState) {
 			false,
 			_rendererState
 		);
+
+		if (Array.isArray(rendered)) {
+			return rendered.join('');
+		}
+		return rendered;
 	} catch (e) {
 		if (e.then) {
 			throw new Error('Use "renderToStringAsync" for suspenseful rendering.');
@@ -682,7 +687,6 @@ function _renderToString(
 
 	if (Array.isArray(html)) return [startTag, ...html, endTag];
 	else if (typeof html !== 'string') return [startTag, html, endTag];
-
 	return startTag + html + endTag;
 }
 


Test patch:
diff --git a/test/render.test.jsx b/test/render.test.jsx
index 05d317a..ffa8a0c 100644
--- a/test/render.test.jsx
+++ b/test/render.test.jsx
@@ -387,6 +387,16 @@ describe('render', () => {
 			);
 		});
 
+		it('should accept nullish __html', () => {
+			const Test = (props) => (
+				<Fragment>
+					<div>hi</div>
+					<div dangerouslySetInnerHTML={{ __html: null }} />
+				</Fragment>
+			);
+			expect(render(<Test />)).to.equal('<div>hi</div><div></div>');
+		});
+
 		it('should apply defaultProps', () => {
 			const Test = (props) => <div {...props} />;
 			Test.defaultProps = {