diff --git a/README.md b/README.md index 367ed60..c92e090 100644 --- a/README.md +++ b/README.md @@ -395,7 +395,7 @@ not the class should stay or go on the vnode. h("a", { class: { active: true, selected: false } }, "Toggle"); ``` -In JSX, you can use the `class` prop. +In JSX, you can use `class` like this: ```jsx
@@ -410,7 +410,7 @@ Allows you to set properties on DOM elements. h("a", { props: { href: "/foo" } }, "Go to Foo"); ``` -In JSX, you can use the `props` prop. +In JSX, you can use `props` like this: ```jsx @@ -433,7 +433,7 @@ Same as props, but set attributes instead of properties on DOM elements. h("a", { attrs: { href: "/foo" } }, "Go to Foo"); ``` -In JSX, you can use the `attrs` prop. +In JSX, you can use `attrs` like this: ```jsx @@ -463,7 +463,7 @@ Allows you to set custom data attributes (`data-*`) on DOM elements. These can t h("button", { dataset: { action: "reset" } }, "Reset"); ``` -In JSX, you can use the `dataset` prop. +In JSX, you can use `dataset` like this: ```jsx @@ -489,6 +489,17 @@ h( ); ``` +In JSX, you can use `style` like this: + +```jsx + +// Renders as: +``` + Note that the style module does not remove style attributes if they are removed as properties from the style object. To remove a style, you should instead set it to the empty string. @@ -601,6 +612,12 @@ function clickHandler(ev) { h("div", { on: { click: clickHandler } }); ``` +In JSX, you can use `on` like this: + +```js + +``` + Very often, however, you're not really interested in the event object itself. Often you have some data associated with the element that triggers an event and you want that data passed along instead.