Skip to content

Commit e5024b6

Browse files
committed
docs: improve "how to use" section
1 parent 979299f commit e5024b6

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,14 @@ const { div, span, h1 } =
9696
With React
9797

9898
```js
99+
// ✅ Preferred
100+
const h = require('react-hyperscript');
101+
const React = require('react');
102+
const { div, span, h1 } =
103+
require('hyperscript-helpers')(h); // ← Notice the (h)
104+
105+
106+
// Also works, but beware of the createElement API
99107
const React = require('react');
100108
const { div, span, h1 } =
101109
require('hyperscript-helpers')(React.createElement); // ← Notice the (React.createElement)
@@ -115,6 +123,10 @@ var div = hh.div,
115123
Once that's done, you can go and use the terse syntax:
116124

117125
```js
126+
$ node
127+
const { div, span, h1 } = require('hyperscript-helpers')(require('hyperscript'));
128+
undefined
129+
118130
span('😍').outerHTML
119131
'<span>😍</span>'
120132

0 commit comments

Comments
 (0)