mroe docs
This commit is contained in:
parent
5815a590a8
commit
e35fc79f09
3 changed files with 264 additions and 3 deletions
36
docs/render.md
Normal file
36
docs/render.md
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
# render(element, vnodes)
|
||||
|
||||
- [Signature](#signature)
|
||||
- [How it works](#how-it-works)
|
||||
- [Standalone usage](#standalone-usage)
|
||||
|
||||
---
|
||||
|
||||
### Signature
|
||||
|
||||
`render(element, vnodes)`
|
||||
|
||||
Argument | Type | Required | Description
|
||||
----------- | -------------------- | -------- | ---
|
||||
`element` | `Element` | Yes | A DOM element that will be the parent node to the subtree
|
||||
`vnodes` | `Array<Vnode>|Vnode` | Yes | The [vnodes](vnodes.md) to be rendered
|
||||
**returns** | | | Returns nothing
|
||||
|
||||
[How to read signatures](signatures.md)
|
||||
|
||||
---
|
||||
|
||||
### 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`.
|
||||
|
||||
This method is internally called by [`m.mount()`](mount.md) and [`m.route()`](route.md).
|
||||
|
||||
---
|
||||
|
||||
### Standalone usage
|
||||
|
||||
The `m.render` module is similar in scope to view libraries like Knockout, React and Vue. It is less than 500 lines of code (3kb min+gzip) and implements a virtual DOM diffing engine with a modern search space reduction algorithm and DOM recycling, which translate to top-of-class performance, both in terms of initial page load and re-rendering. It has no dependencies on other parts of Mithril and can be used as a standalone library.
|
||||
|
||||
Despite being incredibly small, the render module is fully functional and self-suficient. It supports everything you might expect: SVG, custom elements, and all valid attributes and events - without any weird case-sensitive edge cases or exceptions. Of course, it also fully supports [components](components.md) and [lifecycle methods](lifecycle-methods.md).
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue