mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
* 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.
32 lines
922 B
TypeScript
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')
|
|
])
|
|
]);
|
|
}
|
|
}
|