Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,28 @@ const TodoItem = ({ text, isDone, disabled }) => (

For simple use, the [React](#react) example will work for Preact too. However, you may also define a custom vNode "polyfill" to automatically handle Objects when used inside `className`.

#### Preact 10

```js
import objstr from 'obj-str';
import { options } from 'preact';

const old = options.vnode;

options.vnode = vnode => {
const props = vnode.props;
if (typeof props=='object' && props != null) {
const k = 'class' in props ? 'class' : 'className';
if (props[k] && typeof props[k]=='object') {
props[k] = objstr(props[k]);
}
}
old && old(vnode);
};
```

#### Preact versions earlier than 10

> **Note:** For users of Preact 7.1 and below, _you do not need this module_! Your version includes this behavior out of the box!

```js
Expand Down