Skip to content

Commit 2e303b7

Browse files
committed
Add note about app(props, container).
1 parent 08ee34f commit 2e303b7

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

docs/README.md

+10-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,14 @@ app({
5454

5555
In this example we are using a `<script>` tag to download the minified library from a CDN. In a production environment you will probably be using a module bundler to build your application instead.
5656

57-
Hyperapp applications consist of a single `app()` call. This function initializes and renders the application to the page. The `h()` function returns a virtual node tree. A virtual node is a JavaScript object that describes a DOM tree. Hyperapp consumes this object to update the DOM.
57+
Hyperapp applications consist of a single `app()` call. This function initializes and renders the application to document.body. You can select a different container too.
58+
59+
```js
60+
app(
61+
props,
62+
document.getElementById("app")
63+
)
64+
```
5865

5966
### State
6067

@@ -86,6 +93,8 @@ Returning a new state from an action updates the current state and schedules a v
8693
The view describes your user interface as a function of the [state](#state).
8794
Bind user events and [actions](#actions) together to create interactive applications. The view function is called every time we need to re-render the application due to state changes.
8895

96+
The `h()` function returns a virtual node, an object that describes a DOM tree. Hyperapp consumes this object to update the DOM.
97+
8998
Popular alternatives to the built-in `h()` function include [JSX](https://facebook.github.io/jsx/), [Hyperx](https://github.com/choojs/hyperx), [t7](https://github.com/trueadm/t7) and [@hyperapp/html](https://github.com/hyperapp/html).
9099

91100
```html

0 commit comments

Comments
 (0)