Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/sunyoungkwon/react-class-vs-func

πŸ’» μƒν™œμ½”λ”©-React class vs function style κ°•μ˜λ₯Ό μˆ˜κ°•ν•˜λ©° μ‹€μŠ΅ν•œ λ‚΄μš©
https://github.com/sunyoungkwon/react-class-vs-func

react react-hooks

Last synced: about 2 months ago
JSON representation

πŸ’» μƒν™œμ½”λ”©-React class vs function style κ°•μ˜λ₯Ό μˆ˜κ°•ν•˜λ©° μ‹€μŠ΅ν•œ λ‚΄μš©

Awesome Lists containing this project

README

        

# [μƒν™œμ½”λ”©] React class vs function style

## μˆ˜μ—… λ‚΄μš©

React μ»΄ν¬λ„ŒνŠΈλŠ” **class**와 **function** 두 가지 λ°©λ²•μœΌλ‘œ μž‘μ„±ν•  수 μžˆλ‹€.

class 방식은 React의 λͺ¨λ“  κΈ°λŠ₯을 μ‚¬μš©ν•  수 μžˆμ§€λ§Œ ν•΄λ‹Ή 문법을 λͺ¨λ‘ μ•Œμ•„μ•Όν•œλ‹€. function 방식은 κΈ°μ‘΄ javascriptλ₯Ό μ‚¬μš©ν•˜λ˜ μ‚¬λžŒλ“€μ—κ²Œ μ΅μˆ™ν•˜κ³  κ°„νŽΈν•˜μ§€λ§Œ stateλ₯Ό λ§Œλ“€κ±°λ‚˜ lifecycle APIλ₯Ό μ‚¬μš©ν•  수 없이 μƒμœ„ μ»΄ν¬λ„ŒνŠΈκ°€ μ‹œν‚€λŠ” 일만 ν•΄μ•Ό ν–ˆλ‹€. ν•˜μ§€λ§Œ, **hook**이 λ„μž…λ˜λ©΄μ„œ function 방식도 λ‚΄λΆ€μ μœΌλ‘œ μƒνƒœ(state)λ₯Ό 닀루고, 라이프사이클에 λ”°λ₯Έ μž‘μ—…μ„ μ •μ˜ν•  수 μžˆμ–΄μ‘Œλ‹€. κ·ΈλŸ¬λ©΄μ„œ ν•¨μˆ˜ν˜•μ˜ κ°„νŽΈν•¨μ€ κ·ΈλŒ€λ‘œ 가진닀.

μƒν™œμ½”λ”©μ˜ [**React class & function style coding** μˆ˜μ—…](https://opentutorials.org/module/4600)은 같은 μž‘μ—…μ„ ν•˜λŠ” μ»΄ν¬λ„ŒνŠΈλ₯Ό 각각 class와 function 두 가지 λ°©μ‹μœΌλ‘œ μž‘μ„±ν•΄λ³΄λ©° μ„œλ‘œμ˜ 차이점을 μ•Œκ³  μ΄ν•΄ν•˜κΈ° μœ„ν•œ κ°•μ˜μ΄λ‹€.

[μˆ˜μ—…λ‚΄μš© 정리](https://sunnyk.tistory.com/29)