Skip to content

Commit 4878c17

Browse files
authored
Merge branch 'master' into error-boundary-hook
2 parents 2cb78bb + e114bd8 commit 4878c17

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

README.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ It uses standard JavaScript [Tagged Templates] and works in [all modern browsers
2828

2929
The syntax you write when using HTM is as close as possible to JSX:
3030

31-
- Spread props: `<div ...${props}>`
31+
- Spread props: `<div ...${props}>` instead of `<div {...props}>`
3232
- Self-closing tags: `<div />`
33-
- Components: `<${Foo}>` _(where `Foo` is a component reference)_
33+
- Components: `<${Foo}>` instead of `<Foo>` _(where `Foo` is a component reference)_
3434
- Boolean attributes: `<div draggable />`
3535

3636

@@ -153,6 +153,14 @@ console.log(html`
153153
// ]
154154
```
155155

156+
### Caching
157+
158+
The default build of `htm` caches template strings, which means that it can return the same Javascript object at multiple points in the tree. If you don't want this behaviour, you have three options:
159+
160+
* Change your `h` function to copy nodes when needed.
161+
* Add the code `this[0] = 3;` at the beginning of your `h` function, which disables caching of created elements.
162+
* Use `htm/mini`, which disables caching by default.
163+
156164
## Example
157165

158166
Curious to see what it all looks like? Here's a working app!

0 commit comments

Comments
 (0)