Update README.md

pull/967/head
George Treviranus 4 years ago committed by GitHub
parent c67d8a0983
commit 0c3aff4a81
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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
<div class={{ "foo": true, "bar": true }} />
@ -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
<input props={{ name: "foo" }} />
@ -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
<div attrs={{ 'aria-label': "I'm a div" }} />
@ -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
<div dataset={{ foo: "bar" }} />
@ -489,6 +489,17 @@ h(
);
```
In JSX, you can use `style` like this:
```jsx
<div style={{
border: "1px solid #bada55",
color: "#c0ffee",
fontWeight: "bold",
}} />
// Renders as: <div style="border: 1px solid #bada55; color: #c0ffee; font-weight: bold"></div>
```
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
<div on={{ click: clickHandler }} />
```
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.

Loading…
Cancel
Save