export default withTheme(withComment(withLike(Component))));
componentDidMount () {
fetchLikes().then(({ likes, likedByMySelf }) => {
this.setState({ likes, likedByMySelf })
});
fetchComments().thne(comments => {
this.setState({ comments })
});
window.addEventListener('resize', this.onHandleResize);
}
import React, { useState } from 'react'
function Counter () {
// ① OK
const [count, setCount] = useState(0)
// ② X 반복문
for (let i = 0; i < 10; i++) {
var [count2, setCount2] = useState(0)
}
// ③ X 조건문
if (true) {
var [count3, setCount3] = useState(0)
}
// ④ X 중첩된 함수
function innerFnc () {
const [count4, setCount4] = useState(0)
}
...
}
https://velog.io/@velopert/react-hooks
https://hackernoon.com/why-react-hooks-a-developers-perspective-2aedb8511f38
https://john015.github.io/introducing-react-hooks
https://chatoo2412.github.io/javascript/react/react-hooks-overview/#
https://ko.reactjs.org/docs/hooks-intro.html
https://usehooks.com