1 |
|
2 |
|
3 |
|
4 | import React, { Component } from 'react';
|
5 |
|
6 | type TestComponentDefaultProps = {};
|
7 |
|
8 | type TestComponentProps = TestComponentDefaultProps & {
|
9 | children?: mixed,
|
10 | className?: string,
|
11 | };
|
12 |
|
13 | type TestComponentState = void;
|
14 |
|
15 | export class TestComponent extends Component<
|
16 | TestComponentDefaultProps,
|
17 | TestComponentProps,
|
18 | TestComponentState
|
19 | > {
|
20 | static defaultProps = {}
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 | handleClick = () => {
|
39 | console.warn('Clicked!');
|
40 | }
|
41 |
|
42 | render() {
|
43 | const {
|
44 | children,
|
45 | className,
|
46 | ...other
|
47 | } = this.props;
|
48 | return (
|
49 | <div
|
50 | className={ className }
|
51 | data-test="mytest"
|
52 | { ...other }
|
53 | >
|
54 | <div data-label="Self closing" />
|
55 | <button
|
56 | onClick={ this.handleClick }
|
57 | data-test-1
|
58 | data-test-2
|
59 | >
|
60 | Click Me
|
61 | </button>
|
62 | { children }
|
63 | </div>
|
64 | );
|
65 | }
|
66 | }
|