반응형
ComponentDidMount
- //Class
- componentDidMount() {
- console.log('I just mounted!');
- }
- //Hooks
- useEffect(() => {
- console.log('I just mounted!');
- }, [])
ComponentWillUnmount
- //Class
- componentWillUnmount() {
- console.log('I am unmounting');
- }
- //Hooks
- useEffect(() => {
- return () => console.log('I am unmounting');
- }, [])
ComponentWillReceiveProps
- //Class
- componentWillReceiveProps(nextProps) {
- if (nextProps.count !== this.props.count) {
- console.log('count changed', nextProps.count);
- }
- }
- //Hooks
- useEffect(() => {
- console.log('count changed', props.count);
- }, [props.count])
반응형
'Web & Mobile > React.js' 카테고리의 다른 글
Error: Node Sass does not yet support your current environment: OS X 64-bit with Unsupported runtime (83) (0) | 2021.07.17 |
---|---|
React HOOK을 위한 읽을 거리[중요!!!!] (0) | 2021.06.24 |
댓글