docs: rm unimplemented unmounting by 2nd arg null (#539)

Fixes #461.
pull/542/head
Shahar Dawn Or 5 years ago committed by GitHub
parent 814c2e50d7
commit 97a8d50013
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -84,9 +84,6 @@ var newVnode = h('div#container.two.classes', {on: {click: anotherEventHandler}}
]);
// Second `patch` invocation
patch(vnode, newVnode); // Snabbdom efficiently updates the old view to the new state
// to unmount from the DOM and clean up, simply pass null
patch(newVnode, null)
```
## More examples
@ -102,6 +99,7 @@ patch(newVnode, null)
* [Core documentation](#core-documentation)
* [`snabbdom.init`](#snabbdominit)
* [`patch`](#patch)
* [Unmounting](#unmounting)
* [`snabbdom/h`](#snabbdomh)
* [`snabbdom/tovnode`](#snabbdomtovnode)
* [Hooks](#hooks)
@ -179,6 +177,16 @@ vnode tree.
patch(oldVnode, newVnode);
```
#### Unmounting
While there is no API specifically for removing a VNode tree from its mount point element, one way of almost achieving this is providing a comment VNode as the second argument to `patch`, such as:
```js
patch(oldVnode, h('!', { hooks: { post: () => { /* patch complete */ } } }))
```
Of course, then there is still a single comment node at the mount point.
### `snabbdom/h`
It is recommended that you use `snabbdom/h` to create vnodes. `h` accepts a

Loading…
Cancel
Save