Legacy React API
์๋ API๋ react
ํจํค์ง์์ ๋ด๋ณด๋์ง๋งExported ์๋ก ์์ฑํ ์ฝ๋์์๋ ๊ถ์ฅํ์ง ์์ต๋๋ค. ๋งํฌ๋ฅผ ํตํด ๊ฐ๊ฐ์ API ํ์ด์ง์์ ์ ์ํ ๋์์ ํ์ธํด์ฃผ์ธ์.
Legacy APIs
Children
์children
Prop์ผ๋ก ๋ฐ์ JSX๋ฅผ ์กฐ์ํ๊ณ ๋ณํํ ์ ์์ต๋๋ค. ๋์ ํ์ธํ๊ธฐ.cloneElement
๋ฅผ ํตํด ๋ค๋ฅธ ์๋ฆฌ๋จผํธ๋ฅผ ์์์ ์ผ๋ก ์ฌ์ฉํ์ฌ React ์๋ฆฌ๋จผํธ๋ฅผ ์์ฑํ ์ ์์ต๋๋ค. ๋์ ํ์ธํ๊ธฐ.Component
๋ ์๋ฐ์คํฌ๋ฆฝํธ ํด๋์ค๋ก์จ React ์ปดํฌ๋ํธ๋ฅผ ์ ์ํฉ๋๋ค. ๋์ ํ์ธํ๊ธฐ.createElement
๋ก React ์๋ฆฌ๋จผํธ๋ฅผ ์์ฑํฉ๋๋ค. ์ผ๋ฐ์ ์ผ๋ก JSX๋ฅผ ๋์ ์ฌ์ฉํฉ๋๋ค.createRef
๋ ์์์ ๊ฐ์ ํฌํจํ ์ ์๋ ์ฐธ์กฐ ๊ฐ์ฒด๋ฅผ ์์ฑํฉ๋๋ค. ๋์ ํ์ธํ๊ธฐ.forwardRef
๋ ์ปดํฌ๋ํธ๊ฐ ref๋ก DOM ๋ ธ๋๋ฅผ ๋ถ๋ชจ ์ปดํฌ๋ํธ์ ๋ ธ์ถ์ํต๋๋ค.isValidElement
๋ ๊ฐ์ React ์๋ฆฌ๋จผํธ ์ฌ๋ถ๋ฅผ ํ์ธํฉ๋๋ค. ์ผ๋ฐ์ ์ผ๋กcloneElement
์ ํจ๊ป ์ฌ์ฉํฉ๋๋ค.PureComponent
๋Component
์ ์ ์ฌํ์ง๋ง, ๋์ผํ Prop์ ์ฌ๋ ๋๋ง์ ์๋ตํฉ๋๋ค. ๋์ ํ์ธํ๊ธฐ.
Removed APIs
์๋ API๋ค์ React 19์์ ์ ๊ฑฐ๋์์ต๋๋ค.
createFactory
: ๋์ JSX๋ฅผ ์ฌ์ฉํ์ธ์.- ํด๋์ค ์ปดํฌ๋ํธ:
static contextTypes
: ๋์static contextType
๋ฅผ ์ฌ์ฉํ์ธ์. - ํด๋์ค ์ปดํฌ๋ํธ:
static childContextTypes
: ๋์static contextType
๋ฅผ ์ฌ์ฉํ์ธ์. - ํด๋์ค ์ปดํฌ๋ํธ:
static getChildContext
: ๋์Context
๋ฅผ ์ฌ์ฉํ์ธ์. - ํด๋์ค ์ปดํฌ๋ํธ:
static propTypes
: ๋์ TypeScript๊ฐ์ ํ์ ์์คํ ์ ์ฌ์ฉํ์ธ์. - ํด๋์ค ์ปดํฌ๋ํธ:
this.refs
: ๋์createRef
๋ฅผ ์ฌ์ฉํ์ธ์.