diff --git a/.github/ISSUE_TEMPLATE/2-suggestion.yml b/.github/ISSUE_TEMPLATE/2-suggestion.yml deleted file mode 100644 index ac0b480fe..000000000 --- a/.github/ISSUE_TEMPLATE/2-suggestion.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: "๐Ÿ’ก Suggestions" -description: "Suggest a new page, section, or edit for an existing page." -title: "[Suggestion]: " -labels: ["type: documentation"] -body: - - type: textarea - attributes: - label: Summary - description: | - A clear and concise summary of what we should add. - placeholder: | - Example: - Add a new page for how to use React with TypeScript. - validations: - required: true - - type: input - attributes: - label: Page - description: | - What page is this about? - placeholder: | - https://react.dev/ - validations: - required: false - - type: textarea - attributes: - label: Details - description: | - Please provide a explanation for what you're suggesting. - placeholder: | - Example: - I think it would be helpful to have a page that explains how to use React with TypeScript. This could include a basic example of a component written in TypeScript, and a link to the TypeScript documentation. - validations: - required: true diff --git a/.gitignore b/.gitignore index 7bf71dbc5..be4e56a88 100644 --- a/.gitignore +++ b/.gitignore @@ -39,3 +39,8 @@ public/fonts/**/Optimistic_*.woff2 # rss public/rss.xml + +# code editor +.cursor +.idea +*.code-workspace diff --git a/VScode.code-workspace b/VScode.code-workspace deleted file mode 100644 index c7223d8ef..000000000 --- a/VScode.code-workspace +++ /dev/null @@ -1,7 +0,0 @@ -{ - "folders": [ - { - "path": "." - } - ] -} diff --git a/src/components/MDX/ExpandableCallout.tsx b/src/components/MDX/ExpandableCallout.tsx index 73e0e4dc4..48634ffe5 100644 --- a/src/components/MDX/ExpandableCallout.tsx +++ b/src/components/MDX/ExpandableCallout.tsx @@ -27,7 +27,7 @@ interface ExpandableCalloutProps { const variantMap = { deprecated: { - title: '๋” ์ด์ƒ ์‚ฌ์šฉ๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค', + title: '๋” ์ด์ƒ ์‚ฌ์šฉ๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค!', Icon: IconWarning, containerClasses: 'bg-red-5 dark:bg-red-60 dark:bg-opacity-20', textColor: 'text-red-50 dark:text-red-40', @@ -53,7 +53,7 @@ const variantMap = { 'linear-gradient(rgba(245, 249, 248, 0), rgba(245, 249, 248, 1)', }, experimental: { - title: 'Experimental Feature', + title: '์‹คํ—˜์  ๊ธฐ๋Šฅ', Icon: IconCanary, containerClasses: 'bg-green-5 dark:bg-green-60 dark:bg-opacity-20 text-primary dark:text-primary-dark text-lg', @@ -70,7 +70,7 @@ const variantMap = { 'linear-gradient(rgba(249, 247, 243, 0), rgba(249, 247, 243, 1)', }, wip: { - title: '๊ฐœ๋ฐœ์ค‘์ด์—์š”', + title: '๊ฐœ๋ฐœ์ค‘์ด์—์š”!', Icon: IconNote, containerClasses: 'bg-yellow-5 dark:bg-yellow-60 dark:bg-opacity-20', textColor: 'text-yellow-50 dark:text-yellow-40', diff --git a/src/content/reference/react/forwardRef.md b/src/content/reference/react/forwardRef.md index fc6fffa90..b068b57d1 100644 --- a/src/content/reference/react/forwardRef.md +++ b/src/content/reference/react/forwardRef.md @@ -4,15 +4,15 @@ title: forwardRef -In React 19, `forwardRef` is no longer necessary. Pass `ref` as a prop instead. +React 19๋ถ€ํ„ฐ๋Š” ๋” ์ด์ƒ `forwardRef`์ด ํ•„์š”ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ์ด์ œ `ref`๋ฅผ Prop์œผ๋กœ ์ง์ ‘ ์ „๋‹ฌํ•˜๋ฉด ๋ฉ๋‹ˆ๋‹ค. -`forwardRef` will deprecated in a future release. Learn more [here](/blog/2024/04/25/react-19#ref-as-a-prop). +`forwardRef`๋Š” ํ–ฅํ›„ ๋ฆด๋ฆฌ์Šค์—์„œ ์‚ฌ์šฉ ์ค‘๋‹จDeprecated๋  ์˜ˆ์ •์ž…๋‹ˆ๋‹ค. ์ž์„ธํ•œ ๋‚ด์šฉ์€ [์—ฌ๊ธฐ](/blog/2024/12/05/react-19#ref-as-a-prop)์—์„œ ํ™•์ธํ•˜์„ธ์š”. -`forwardRef`๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ์ปดํฌ๋„ŒํŠธ๊ฐ€ [ref](/learn/manipulating-the-dom-with-refs)๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๋ถ€๋ชจ ์ปดํฌ๋„ŒํŠธ์˜ DOM ๋…ธ๋“œ๋ฅผ ๋…ธ์ถœํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. +`forwardRef`๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ์ปดํฌ๋„ŒํŠธ๊ฐ€ [Ref](/learn/manipulating-the-dom-with-refs)๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๋ถ€๋ชจ ์ปดํฌ๋„ŒํŠธ์˜ DOM ๋…ธ๋“œ๋ฅผ ๋…ธ์ถœํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ```js const SomeComponent = forwardRef(render) @@ -28,7 +28,7 @@ const SomeComponent = forwardRef(render) ### `forwardRef(render)` {/*forwardref*/} -์ปดํฌ๋„ŒํŠธ๊ฐ€ ref๋ฅผ ๋ฐ›์•„ ํ•˜์œ„ ์ปดํฌ๋„ŒํŠธ๋กœ ์ „๋‹ฌํ•˜๋„๋ก ํ•˜๋ ค๋ฉด `forwardRef()`๋ฅผ ํ˜ธ์ถœํ•˜์„ธ์š”. +์ปดํฌ๋„ŒํŠธ๊ฐ€ Ref๋ฅผ ๋ฐ›์•„ ํ•˜์œ„ ์ปดํฌ๋„ŒํŠธ๋กœ ์ „๋‹ฌํ•˜๋„๋ก ํ•˜๋ ค๋ฉด `forwardRef()`๋ฅผ ํ˜ธ์ถœํ•˜์„ธ์š”. ```js import { forwardRef } from 'react'; @@ -42,22 +42,22 @@ const MyInput = forwardRef(function MyInput(props, ref) { #### ๋งค๊ฐœ๋ณ€์ˆ˜ {/*parameters*/} -* `render`: ์ปดํฌ๋„ŒํŠธ์˜ ๋ Œ๋”๋ง ํ•จ์ˆ˜์ž…๋‹ˆ๋‹ค. React๋Š” ์ปดํฌ๋„ŒํŠธ๊ฐ€ ๋ถ€๋ชจ๋กœ๋ถ€ํ„ฐ ๋ฐ›์€ props์™€ `ref`๋กœ ์ด ํ•จ์ˆ˜๋ฅผ ํ˜ธ์ถœํ•ฉ๋‹ˆ๋‹ค. ๋ฐ˜ํ™˜ํ•˜๋Š” JSX๋Š” ์ปดํฌ๋„ŒํŠธ์˜ ๊ฒฐ๊ณผ๊ฐ€ ๋ฉ๋‹ˆ๋‹ค. +* `render`: ์ปดํฌ๋„ŒํŠธ์˜ ๋ Œ๋”๋ง ํ•จ์ˆ˜์ž…๋‹ˆ๋‹ค. React๋Š” ์ปดํฌ๋„ŒํŠธ๊ฐ€ ๋ถ€๋ชจ๋กœ๋ถ€ํ„ฐ ๋ฐ›์€ `props`์™€ `ref`๋กœ ์ด ํ•จ์ˆ˜๋ฅผ ํ˜ธ์ถœํ•ฉ๋‹ˆ๋‹ค. ๋ฐ˜ํ™˜ํ•˜๋Š” JSX๋Š” ์ปดํฌ๋„ŒํŠธ์˜ ๊ฒฐ๊ณผ๊ฐ€ ๋ฉ๋‹ˆ๋‹ค. #### ๋ฐ˜ํ™˜๊ฐ’ {/*returns*/} -`forwardRef`๋Š” JSX์—์„œ ๋ Œ๋”๋งํ•  ์ˆ˜ ์žˆ๋Š” React ์ปดํฌ๋„ŒํŠธ๋ฅผ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค. ์ผ๋ฐ˜ ํ•จ์ˆ˜๋กœ ์ •์˜๋œ React ์ปดํฌ๋„ŒํŠธ์™€ ๋‹ค๋ฅด๊ฒŒ, `forwardRef`๊ฐ€ ๋ฐ˜ํ™˜ํ•˜๋Š” ์ปดํฌ๋„ŒํŠธ๋Š” `ref` prop๋„ ๋ฐ›์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. +`forwardRef`๋Š” JSX์—์„œ ๋ Œ๋”๋งํ•  ์ˆ˜ ์žˆ๋Š” React ์ปดํฌ๋„ŒํŠธ๋ฅผ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค. ์ผ๋ฐ˜ ํ•จ์ˆ˜๋กœ ์ •์˜๋œ React ์ปดํฌ๋„ŒํŠธ์™€ ๋‹ค๋ฅด๊ฒŒ, `forwardRef`๊ฐ€ ๋ฐ˜ํ™˜ํ•˜๋Š” ์ปดํฌ๋„ŒํŠธ๋Š” `ref` Prop๋„ ๋ฐ›์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. #### ์ฃผ์˜ ์‚ฌํ•ญ {/*caveats*/} -* Strict Mode์—์„œ React๋Š” [์‹ค์ˆ˜๋กœ ๋ฐœ์ƒํ•œ ๊ฒฐํ•จ์„ ์ฐพ๊ธฐ ์œ„ํ•ด](/reference/react/useState#my-initializer-or-updater-function-runs-twice) **๋ Œ๋”๋ง ํ•จ์ˆ˜๋ฅผ ๋‘ ๋ฒˆ ํ˜ธ์ถœ**ํ•ฉ๋‹ˆ๋‹ค. ์ด๋Š” ๊ฐœ๋ฐœ ํ™˜๊ฒฝ ์ „์šฉ ๋™์ž‘์ด๋ฉฐ ํ”„๋กœ๋•์…˜ ํ™˜๊ฒฝ์—๋Š” ์˜ํ–ฅ์„ ๋ฏธ์น˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ๋ Œ๋”๋ง ํ•จ์ˆ˜๊ฐ€ ์ˆœ์ˆ˜ํ•จ์ˆ˜์ธ ๊ฒฝ์šฐ(๊ทธ๋ž˜์•ผ๋งŒ ํ•ฉ๋‹ˆ๋‹ค.) ์ปดํฌ๋„ŒํŠธ ๋กœ์ง์— ์˜ํ–ฅ์„ ๋ฏธ์น˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ํ˜ธ์ถœ ๊ฒฐ๊ณผ ์ค‘ ํ•˜๋‚˜์˜ ๊ฒฐ๊ณผ๋Š” ๋ฌด์‹œ๋ฉ๋‹ˆ๋‹ค. +* Strict Mode์—์„œ React๋Š” [์‹ค์ˆ˜๋กœ ๋ฐœ์ƒํ•œ ๊ฒฐํ•จ์„ ์ฐพ๊ธฐ ์œ„ํ•ด](/reference/react/useState#my-initializer-or-updater-function-runs-twice) **๋ Œ๋”๋ง ํ•จ์ˆ˜๋ฅผ ๋‘ ๋ฒˆ ํ˜ธ์ถœ**ํ•ฉ๋‹ˆ๋‹ค. ์ด๋Š” ๊ฐœ๋ฐœ ํ™˜๊ฒฝ ์ „์šฉ ๋™์ž‘์ด๋ฉฐ ํ”„๋กœ๋•์…˜ ํ™˜๊ฒฝ์—๋Š” ์˜ํ–ฅ์„ ๋ฏธ์น˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ๋ Œ๋”๋ง ํ•จ์ˆ˜๊ฐ€ ์ˆœ์ˆ˜ ํ•จ์ˆ˜์ธ ๊ฒฝ์šฐ(๊ทธ๋ž˜์•ผ๋งŒ ํ•ฉ๋‹ˆ๋‹ค), ์ปดํฌ๋„ŒํŠธ ๋กœ์ง์— ์˜ํ–ฅ์„ ๋ฏธ์น˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ํ˜ธ์ถœ ๊ฒฐ๊ณผ ์ค‘ ํ•˜๋‚˜์˜ ๊ฒฐ๊ณผ๋Š” ๋ฌด์‹œ๋ฉ๋‹ˆ๋‹ค. --- ### `render` ํ•จ์ˆ˜ {/*render-function*/} -`forwardRef`๋Š” `render` ํ•จ์ˆ˜๋ฅผ ์ธ์ˆ˜๋กœ ๋ฐ›์Šต๋‹ˆ๋‹ค. React๋Š” `props`์™€ `ref`์™€ ํ•จ๊ป˜ ์ด ํ•จ์ˆ˜๋ฅผ ํ˜ธ์ถœํ•ฉ๋‹ˆ๋‹ค. +`forwardRef`๋Š” `render` ํ•จ์ˆ˜๋ฅผ ์ธ์ˆ˜๋กœ ๋ฐ›์Šต๋‹ˆ๋‹ค. React๋Š” `props` ๋ฐ `ref`์™€ ํ•จ๊ป˜ ์ด ํ•จ์ˆ˜๋ฅผ ํ˜ธ์ถœํ•ฉ๋‹ˆ๋‹ค. ```js const MyInput = forwardRef(function MyInput(props, ref) { @@ -72,13 +72,13 @@ const MyInput = forwardRef(function MyInput(props, ref) { #### ๋งค๊ฐœ๋ณ€์ˆ˜ {/*render-parameters*/} -* `props`: ๋ถ€๋ชจ ์ปดํฌ๋„ŒํŠธ๊ฐ€ ์ „๋‹ฌํ•œ props์ž…๋‹ˆ๋‹ค. +* `props`: ๋ถ€๋ชจ ์ปดํฌ๋„ŒํŠธ๊ฐ€ ์ „๋‹ฌํ•œ Props์ž…๋‹ˆ๋‹ค. -* `ref`: ๋ถ€๋ชจ ์ปดํฌ๋„ŒํŠธ๊ฐ€ ์ „๋‹ฌํ•œ `ref` ์–ดํŠธ๋ฆฌ๋ทฐํŠธ์ž…๋‹ˆ๋‹ค. `ref`๋Š” ๊ฐ์ฒด๋‚˜ ํ•จ์ˆ˜์ผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๋ถ€๋ชจ ์ปดํฌ๋„ŒํŠธ๊ฐ€ ref๋ฅผ ์ „๋‹ฌํ•˜์ง€ ์•Š์€ ๊ฒฝ์šฐ `null`์ด ๋ฉ๋‹ˆ๋‹ค. ์ „๋‹ฌ๋ฐ›์€ `ref`๋ฅผ ๋‹ค๋ฅธ ์ปดํฌ๋„ŒํŠธ์— ์ „๋‹ฌํ•˜๊ฑฐ๋‚˜ [`useImperativeHandle`.](/reference/react/useImperativeHandle)์— ์ „๋‹ฌํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. +* `ref`: ๋ถ€๋ชจ ์ปดํฌ๋„ŒํŠธ๊ฐ€ ์ „๋‹ฌํ•œ `ref` ์–ดํŠธ๋ฆฌ๋ทฐํŠธ์ž…๋‹ˆ๋‹ค. `ref`๋Š” ๊ฐ์ฒด๋‚˜ ํ•จ์ˆ˜์ผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๋ถ€๋ชจ ์ปดํฌ๋„ŒํŠธ๊ฐ€ Ref๋ฅผ ์ „๋‹ฌํ•˜์ง€ ์•Š์€ ๊ฒฝ์šฐ `null`์ด ๋ฉ๋‹ˆ๋‹ค. ์ „๋‹ฌ๋ฐ›์€ `ref`๋ฅผ ๋‹ค๋ฅธ ์ปดํฌ๋„ŒํŠธ์— ์ „๋‹ฌํ•˜๊ฑฐ๋‚˜ [`useImperativeHandle`](/reference/react/useImperativeHandle)์— ์ „๋‹ฌํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. #### ๋ฐ˜ํ™˜๊ฐ’ {/*render-returns*/} -`forwardRef`๋Š” JSX์—์„œ ๋ Œ๋”๋งํ•  ์ˆ˜ ์žˆ๋Š” React ์ปดํฌ๋„ŒํŠธ๋ฅผ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค. ์ผ๋ฐ˜ ํ•จ์ˆ˜๋กœ ์ •์˜๋œ React ์ปดํฌ๋„ŒํŠธ์™€ ๋‹ค๋ฅด๊ฒŒ `forwardRef` ์— ์˜ํ•ด ๋ฐ˜ํ™˜๋˜๋Š” ์ปดํฌ๋„ŒํŠธ๋Š” `ref` prop๋ฅผ ๋ฐ›์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. +`forwardRef`๋Š” JSX์—์„œ ๋ Œ๋”๋งํ•  ์ˆ˜ ์žˆ๋Š” React ์ปดํฌ๋„ŒํŠธ๋ฅผ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค. ์ผ๋ฐ˜ ํ•จ์ˆ˜๋กœ ์ •์˜๋œ React ์ปดํฌ๋„ŒํŠธ์™€ ๋‹ค๋ฅด๊ฒŒ `forwardRef`์— ์˜ํ•ด ๋ฐ˜ํ™˜๋˜๋Š” ์ปดํฌ๋„ŒํŠธ๋Š” `ref` Prop๋ฅผ ๋ฐ›์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. --- @@ -86,7 +86,7 @@ const MyInput = forwardRef(function MyInput(props, ref) { ### ๋ถ€๋ชจ ์ปดํฌ๋„ŒํŠธ์— DOM ๋…ธ๋“œ ๋…ธ์ถœํ•˜๊ธฐ {/*exposing-a-dom-node-to-the-parent-component*/} -๊ธฐ๋ณธ์ ์œผ๋กœ ๊ฐ ์ปดํฌ๋„ŒํŠธ์˜ DOM ๋…ธ๋“œ๋Š” ๋น„๊ณต๊ฐœ์ž…๋‹ˆ๋‹ค. ๊ทธ๋Ÿฌ๋‚˜ ๋•Œ๋กœ๋Š” ๋ถ€๋ชจ์— DOM ๋…ธ๋“œ๋ฅผ ๋…ธ์ถœํ•˜๋Š” ๊ฒƒ์ด ์œ ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์˜ˆ๋ฅผ ๋“ค์–ด focus ํ•˜๊ธฐ ์œ„ํ•ด ๋…ธ์ถœํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ด๋ฅผ ์œ„ํ•ด ์ปดํฌ๋„ŒํŠธ ์ •์˜๋ฅผ `forwardRef()`๋กœ ๊ฐ์‹ธ์ฃผ๋ฉด ๋ฉ๋‹ˆ๋‹ค. +๊ธฐ๋ณธ์ ์œผ๋กœ ๊ฐ ์ปดํฌ๋„ŒํŠธ์˜ DOM ๋…ธ๋“œ๋Š” ๋น„๊ณต๊ฐœ์ž…๋‹ˆ๋‹ค. ๊ทธ๋Ÿฌ๋‚˜ ๋•Œ๋กœ๋Š” ๋ถ€๋ชจ์— DOM ๋…ธ๋“œ๋ฅผ ๋…ธ์ถœํ•˜๋Š” ๊ฒƒ์ด ์œ ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์˜ˆ๋ฅผ ๋“ค์–ด ํฌ์ปค์ŠคFocus ํ•˜๊ธฐ ์œ„ํ•ด ๋…ธ์ถœํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ด๋ฅผ ์œ„ํ•ด ์ปดํฌ๋„ŒํŠธ ์ •์˜๋ฅผ `forwardRef()`๋กœ ๊ฐ์‹ธ์ฃผ๋ฉด ๋ฉ๋‹ˆ๋‹ค. ```js {3,11} import { forwardRef } from 'react'; @@ -102,7 +102,7 @@ const MyInput = forwardRef(function MyInput(props, ref) { }); ``` -props ๋‹ค์Œ์— ๋‘ ๋ฒˆ์งธ ์ธ์ˆ˜๋กœ ref๋ฅผ ๋ฐ›๊ฒŒ ๋ฉ๋‹ˆ๋‹ค. ๋…ธ์ถœํ•˜๋ ค๋Š” DOM ๋…ธ๋“œ์— ์ด๋ฅผ ์ „๋‹ฌํ•ฉ๋‹ˆ๋‹ค. +`props` ๋‹ค์Œ์— ๋‘ ๋ฒˆ์งธ ์ธ์ˆ˜๋กœ ref๋ฅผ ๋ฐ›๊ฒŒ ๋ฉ๋‹ˆ๋‹ค. ๋…ธ์ถœํ•˜๋ ค๋Š” DOM ๋…ธ๋“œ์— ์ด๋ฅผ ์ „๋‹ฌํ•ฉ๋‹ˆ๋‹ค. ```js {8} [[1, 3, "ref"], [1, 8, "ref", 30]] import { forwardRef } from 'react'; @@ -139,15 +139,15 @@ function Form() { } ``` -์ด `Form` ์ปดํฌ๋„ŒํŠธ๋Š” `MyInput` ์—๊ฒŒ [ref๋ฅผ ์ „๋‹ฌ](/reference/react/useRef#manipulating-the-dom-with-a-ref)ํ•ฉ๋‹ˆ๋‹ค. `MyInput` ์ปดํฌ๋„ŒํŠธ๋Š” ํ•ด๋‹น ref๋ฅผ `` ํƒœ๊ทธ์— ์ „๋‹ฌํ•ฉ๋‹ˆ๋‹ค. ๊ฒฐ๊ณผ์ ์œผ๋กœ `Form` ์ปดํฌ๋„ŒํŠธ๋Š” ํ•ด๋‹น `` DOM ๋…ธ๋“œ์— ์ ‘๊ทผํ•˜์—ฌ [`focus()`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus)๋ฅผ ํ˜ธ์ถœํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. +์ด `Form` ์ปดํฌ๋„ŒํŠธ๋Š” `MyInput` ์—๊ฒŒ [Ref๋ฅผ ์ „๋‹ฌ](/reference/react/useRef#manipulating-the-dom-with-a-ref)ํ•ฉ๋‹ˆ๋‹ค. `MyInput` ์ปดํฌ๋„ŒํŠธ๋Š” ํ•ด๋‹น Ref๋ฅผ `` ํƒœ๊ทธ์— ์ „๋‹ฌํ•ฉ๋‹ˆ๋‹ค. ๊ฒฐ๊ณผ์ ์œผ๋กœ `Form` ์ปดํฌ๋„ŒํŠธ๋Š” ํ•ด๋‹น `` DOM ๋…ธ๋“œ์— ์ ‘๊ทผํ•˜์—ฌ [`focus()`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus)๋ฅผ ํ˜ธ์ถœํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. -์ปดํฌ๋„ŒํŠธ ๋‚ด๋ถ€์˜ DOM ๋…ธ๋“œ์˜ ref๋ฅผ ๋…ธ์ถœํ•˜๋ฉด ๋‚˜์ค‘์— ์ปดํฌ๋„ŒํŠธ์˜ ๋‚ด๋ถ€๋ฅผ ๋ณ€๊ฒฝํ•˜๊ธฐ๊ฐ€ ๋” ์–ด๋ ค์›Œ์ง„๋‹ค๋Š” ์ ์— ์œ ์˜ํ•˜์„ธ์š”. ์ผ๋ฐ˜์ ์œผ๋กœ ๋ฒ„ํŠผ์ด๋‚˜ ํ…์ŠคํŠธ input๊ณผ ๊ฐ™์ด ์žฌ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋Š” ์ €์ˆ˜์ค€ ์ปดํฌ๋„ŒํŠธ์—์„œ DOM ๋…ธ๋“œ๋ฅผ ๋…ธ์ถœํ•˜์ง€๋งŒ, ์•„๋ฐ”ํƒ€๋‚˜ ๋Œ“๊ธ€ ๊ฐ™์€ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ๋ ˆ๋ฒจ์˜ ์ปดํฌ๋„ŒํŠธ์—์„œ๋Š” ๋…ธ์ถœํ•˜๊ณ  ์‹ถ์ง€ ์•Š์„ ๊ฒƒ์ž…๋‹ˆ๋‹ค. +์ปดํฌ๋„ŒํŠธ ๋‚ด๋ถ€ DOM ๋…ธ๋“œ์˜ Ref๋ฅผ ๋…ธ์ถœํ•˜๋ฉด ๋‚˜์ค‘์— ์ปดํฌ๋„ŒํŠธ์˜ ๋‚ด๋ถ€๋ฅผ ๋ณ€๊ฒฝํ•˜๊ธฐ๊ฐ€ ๋” ์–ด๋ ค์›Œ์ง„๋‹ค๋Š” ์ ์— ์œ ์˜ํ•˜์„ธ์š”. ์ผ๋ฐ˜์ ์œผ๋กœ ๋ฒ„ํŠผ์ด๋‚˜ ํ…์ŠคํŠธ Input๊ณผ ๊ฐ™์ด ์žฌ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋Š” ์ €์ˆ˜์ค€ ์ปดํฌ๋„ŒํŠธ์—์„œ DOM ๋…ธ๋“œ๋ฅผ ๋…ธ์ถœํ•˜์ง€๋งŒ, ์•„๋ฐ”ํƒ€๋‚˜ ๋Œ“๊ธ€ ๊ฐ™์€ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ๋ ˆ๋ฒจ์˜ ์ปดํฌ๋„ŒํŠธ์—์„œ๋Š” ๋…ธ์ถœํ•˜๊ณ  ์‹ถ์ง€ ์•Š์„ ๊ฒƒ์ž…๋‹ˆ๋‹ค. -#### ํ…์ŠคํŠธ input์— ์ดˆ์  ๋งž์ถ”๊ธฐ {/*focusing-a-text-input*/} +#### ํ…์ŠคํŠธ Input์— ์ดˆ์  ๋งž์ถ”๊ธฐ {/*focusing-a-text-input*/} -๋ฒ„ํŠผ์„ ํด๋ฆญํ•˜๋ฉด input์— ํฌ์ปค์Šค ๋ฉ๋‹ˆ๋‹ค. `Form` ์ปดํฌ๋„ŒํŠธ๋Š” ref๋ฅผ ์ •์˜ํ•˜๊ณ  ์ด๋ฅผ `MyInput` ์ปดํฌ๋„ŒํŠธ๋กœ ์ „๋‹ฌํ•ฉ๋‹ˆ๋‹ค. `MyInput` ์ปดํฌ๋„ŒํŠธ๋Š” ํ•ด๋‹น ref๋ฅผ `input`์œผ๋กœ ์ „๋‹ฌํ•ฉ๋‹ˆ๋‹ค. ์ด๋ ‡๊ฒŒ ํ•˜๋ฉด `Form` ์ปดํฌ๋„ŒํŠธ๊ฐ€ `input`์˜ ํฌ์ปค์Šค๋ฅผ ์ค„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. +๋ฒ„ํŠผ์„ ํด๋ฆญํ•˜๋ฉด Input์— ํฌ์ปค์Šค๋ฉ๋‹ˆ๋‹ค. `Form` ์ปดํฌ๋„ŒํŠธ๋Š” Ref๋ฅผ ์ •์˜ํ•˜๊ณ  ์ด๋ฅผ `MyInput` ์ปดํฌ๋„ŒํŠธ๋กœ ์ „๋‹ฌํ•ฉ๋‹ˆ๋‹ค. `MyInput` ์ปดํฌ๋„ŒํŠธ๋Š” ํ•ด๋‹น Ref๋ฅผ `input`์œผ๋กœ ์ „๋‹ฌํ•ฉ๋‹ˆ๋‹ค. ์ด๋ ‡๊ฒŒ ํ•˜๋ฉด `Form` ์ปดํฌ๋„ŒํŠธ๊ฐ€ `input`์— ํฌ์ปค์Šค๋ฅผ ์ค„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. @@ -201,7 +201,7 @@ input { #### ๋น„๋””์˜ค ์žฌ์ƒ ๋ฐ ์ •์ง€ํ•˜๊ธฐ {/*playing-and-pausing-a-video*/} -๋ฒ„ํŠผ์„ ํด๋ฆญํ•˜๋ฉด `