-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcomponent_template.jsx
More file actions
50 lines (38 loc) · 930 Bytes
/
component_template.jsx
File metadata and controls
50 lines (38 loc) · 930 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// Class component -----------------------------------------------------------
// import React, { Component } from 'react';
// import './Example.css';
// class Example extends Component {
// static defaultProps = {
// };
// constructor(props) {
// super(props);
// this.state = {};
// }
// render() {
// return (
// <div className="Example">
// </div>
// );
// }
// }
// export default Example;
// Functional component ------------------------------------------------------
import React, { useState, useEffect } from 'react';
import './Example.css';
export default function Example(props) {
// props
// const {} = props;
// state
const [name, setName] = useState('');
useEffect(() => {
console.log('mount');
return () => {
console.log('cleanup');
}
}, []);
return (
<div className="Example">
{/* Here's my comment */}
</div>
);
}