• 로그인
  • 장바구니에 상품이 없습니다.

home2 게시판 JavaScript, TS 게시판 tsx 파일 jsx파일로 어떻게 변환시키나요?

tsx 파일 jsx파일로 어떻게 변환시키나요?

2 글 보임 - 1 에서 2 까지 (총 2 중에서)
  • 글쓴이
  • #18144

    양호준
    참가자

    tsx 파일 jsx파일로 어떻게 변환시키나요?

    stackoverflow에서 

    1

    If your files are getting converted to .js and you want .jsx instead, that's because TypeScript is converting the TS code to actual JS code that injects the React nodes as needed. That is because of the

    "jsx": "react"

    Property you have on your file.

    If you want to preserve the React syntax and have it output the extension as .jsx, do

    "jsx": "preserve"

    As explained in the handbook.
    Share
    Improve this answer
    Follow

    이렇게 하라고해서 tsconfig.json에서 preserve로 변경했는데 변경이 되지 않습니다,ㅠ

    #18148

    codingapple
    키 마스터

    일반 폴더에 있는 파일들 tsc -w 해놓을 때 "jsx" : "preserve" 그렇게 해놓으면 jsx 로 변환해줍니다

    리액트프로젝트에 있는 tsx 파일이면 굳이 jsx로 바꿔서 쓸 필요는 없습니다 그 리액트 파일을 다른 폴더로 옮겨서 tsc -w 하면 되긴 하겠군요 

2 글 보임 - 1 에서 2 까지 (총 2 중에서)
  • 답변은 로그인 후 가능합니다.

About

현재 월 700명 신규수강중입니다.

  (09:00~20:00) 빠른 상담은 카톡 플러스친구 코딩애플 (링크)
  admin@codingapple.com
  이용약관
ⓒ Codingapple, 강의 예제, 영상 복제 금지
top

© Codingapple, All rights reserved. 슈퍼로켓 에듀케이션 / 서울특별시 강동구 고덕로 19길 30 / 사업자등록번호 : 212-26-14752 온라인 교육학원업 / 통신판매업신고번호 : 제 2017-서울강동-0002 호 / 개인정보관리자 : 박종흠