DefinitelyTyped/types/react-hyperscript/react-hyperscript-tests.ts
Tomoki Ohno 288e9dd83f Add new definition: react-hyperscript (#20693)
* Add new package: react-hyperscript

* Type of function should be declared by function keyword...

* Add a workaround

tsc does not allow `export =`ing function because ES spec does not allow that.
But react-hyperscript does that.
So this workaround is required.
2017-10-18 14:26:47 -07:00

32 lines
922 B
TypeScript

import * as React from 'react';
import * as h from 'react-hyperscript';
class SomeComponent extends React.Component {
render() {
return React.createElement('div');
}
}
const StatelessComponent = () => React.createElement('div');
class MainComponent extends React.Component {
render() {
return h('div.example', [
h('h1#heading', 'This is hyperscript'),
h('h2', 'creating React.js markup'),
h(SomeComponent, {foo: 'bar'}, [
h('li', [
h('a', {href: 'http://whatever.com'}, 'One list item')
]),
h('li', 'Another list item')
]),
h(StatelessComponent, {foo: 'bar'}, [
h('li', [
h('a', {href: 'http://whatever.com'}, 'One list item')
]),
h('li', 'Another list item')
])
]);
}
}