Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 9.2.1-2 예제 코드 오류 수정 #15

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

redcontroller
Copy link

안녕하세요, 책 재미있게 읽고 있습니다.
책의 코드를 따라 치다가 어색한 부분이 있어 PR 드립니다.

수정사항

커스텀 훅을 사용하는 MyComponent 예제 코드에 수정 사항이 있습니다.
(1) input 태그의 value 속성으로 전달되는 상태 변수명 변경: text -> value
(2) 내보내기(export default)하는 컴포넌트명 변경: App -> MyComponent

수정 전

const MyComponent = () => {
  const { value, onChange } = useInput("");
  
  return (
    <div>
      <h1>{value}</h1>
      <input onChange= {onChange} value= {text} />
    </div>
  );
};

export default App;

수정 후

const MyComponent = () => {
  const { value, onChange } = useInput("");
  
  return (
    <div>
      <h1>{value}</h1>
      <input onChange={onChange} value={value} />
    </div>
  );
};

export default MyComponent;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant