15.9.2 게시글 작성 화면 만들기

    이번에는 방금 만든 버튼을 눌렀을 때 보여줄 새 게시글 작성 화면을 만들어봅시다. 컴포넌트의 이름은 WriteScreen이라고 하겠습니다. 추후 라우트 파라미터로 수정할 때도 이 화면 컴포넌트를 사용하겠습니다. screens/types.ts에서 RootStackParamList를 다음과 같이 수정해주세요.

    screens/types.ts - RootStackParamList

    export type RootStackParamList = {
      MainTab: MainTabNavigationScreenParams;
      Article: {
        id: number;
      };
      Register: undefined;
      Login: undefined;
      MyArticles: undefined;
      Write: {
        articleId?: number;
      };
    };

    새 게시글을 작성할 때는 articleIdundefined로 설정하고, 수정할 때는 여기에 수정할 게시글의 id 값을 설정하는 방식으로 구현하겠습니다.

    신간 소식 구독하기
    뉴스레터에 가입하시고 이메일로 신간 소식을 받아 보세요.