Skip to content

Commit 2beb8fa

Browse files
Update docs for adding custom JavaScript to home.js
1 parent 74ff6b3 commit 2beb8fa

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

docs/docs/custom-html.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,18 @@ If you see this error: `Uncaught Error: _registerComponent(...): Target containe
4040
dangerouslySetInnerHTML={{ __html: this.props.body }}
4141
/>
4242
```
43+
44+
### Adding custom JavaScript
45+
46+
You can add custom JavaScript to your HTML document by using React's [dangerouslySetInnerHTML](https://reactjs.org/docs/dom-elements.html#dangerouslysetinnerhtml) attribute.
47+
48+
```jsx
49+
<script
50+
dangerouslySetInnerHTML={{
51+
__html: `
52+
var name = 'world';
53+
console.log('Hello ' + name);
54+
`
55+
}}
56+
/>
57+
```

0 commit comments

Comments
 (0)