UNPKG

1.38 kBJSXView Raw
1// @flow
2/* eslint-disable react/prop-types */
3
4import React, { Component } from 'react';
5
6type TestComponentDefaultProps = {};
7
8type TestComponentProps = TestComponentDefaultProps & {
9 children?: mixed,
10 className?: string,
11};
12
13type TestComponentState = void;
14
15export class TestComponent extends Component<
16 TestComponentDefaultProps,
17 TestComponentProps,
18 TestComponentState
19> {
20 static defaultProps = {}
21
22 // componentWillMount() {}
23
24 // componentDidMount() {}
25
26 // componentWillReceiveProps(nextProps: TestComponentProps) {}
27
28 // componentDidReceiveProps() {}
29
30 // shouldComponentUpdate(nextProps: TestComponentProps, nextState: TestComponentState) {}
31
32 // componentWillUpdate(nextProps: TestComponentProps, nextState: TestComponentState) {}
33
34 // componentDidUpdate(prevProps: TestComponentProps, prevState: TestComponentState) {}
35
36 // componentWillUnmount() {}
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}