update docs

This commit is contained in:
Leo Horie 2016-06-20 09:22:00 -04:00
parent b9ce90765d
commit ce0c30a235
11 changed files with 849 additions and 236 deletions

View file

@ -1,14 +1,13 @@
# render(element, vnodes)
- [Signature](#signature)
- [How it works](#how-it-works)
- [API](#api)
- [Standalone usage](#standalone-usage)
---
### Signature
### API
`render(element, vnodes)`
`m.render(element, vnodes)`
Argument | Type | Required | Description
----------- | -------------------- | -------- | ---
@ -22,9 +21,9 @@ Argument | Type | Required | Description
### How it works
The `m.render(element, vnodes)` method takes a virtual DOM tree (typically generated via the [`m()` hyperscript function](hyperscript.md), generates a DOM tree and appends it to `element`.
The `m.render(element, vnodes)` method takes a virtual DOM tree (typically generated via the [`m()` hyperscript function](hyperscript.md), generates a DOM tree and mounts it on `element`. If `element` already has a DOM tree mounted via a previous `m.render()` call, `vnodes` is diffed against the previous `vnodes` tree and the existing DOM tree is modified where needed to reflect the changes.
This method is internally called by [`m.mount()`](mount.md) and [`m.route()`](route.md).
This method is internally called by [`m.mount()`](mount.md), [`m.route()`](route.md) amd `[m.request()](request.md)`.
---