mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
42 lines
1.1 KiB
TypeScript
42 lines
1.1 KiB
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')
|
|
])
|
|
]);
|
|
}
|
|
}
|
|
|
|
class MixedComponent extends React.Component {
|
|
render() {
|
|
return h('div', {className: 'some class'}, [
|
|
null,
|
|
h('span', 'some tag'),
|
|
'some text node'
|
|
]);
|
|
}
|
|
}
|