From 770b3b380751920bd6873b7e9e59c4aebcc3d10a Mon Sep 17 00:00:00 2001 From: Andrew Leedham Date: Tue, 23 Jun 2020 22:42:48 +0100 Subject: [PATCH] Add dangerouslySetInnerHTML documentation https://github.com/developit/vhtml/pull/17#issuecomment-648393254 --- README.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/README.md b/README.md index 1c41422..c269a2b 100644 --- a/README.md +++ b/README.md @@ -101,3 +101,20 @@ The above outputs the following HTML: ``` + +### dangerouslySetInnerHTML +As with React and Preact you can provide the prop `dangerouslySetInnerHTML` with an object containing `{__html: '

HTML Content

'}` to directly set the HTML content of an element. However, this is not advisable as it will ignore any children passed to it, and removes the benefits of JSX. + +Here is an example: +```js +
HTML Content'}}> + Overwritten content! +
+``` + +The above outputs the following HTML: +```html +
+

HTML Content

+
+```