/React

πŸ“– React에 λŒ€ν•΄ ν•™μŠ΅ν•œ λ‚΄μš©μ„ μ •λ¦¬ν•œ λ ˆν¬μ§€ν† λ¦¬μž…λ‹ˆλ‹€.

Primary LanguageJavaScript

μ‹œμž‘ν•˜κΈ°

  1. Node.js μ„€μΉ˜ν•˜κΈ° (npx μ‚¬μš©ν•˜κΈ° μœ„ν•΄)
  2. npx create-react-app {폴더 이름}
    1. 폴더 이름에 . 을 μž…λ ₯ β‡’ ν˜„μž¬ 디렉토리

μ„€μΉ˜

  • npm start
    • Starts the development server.
    • λ¦¬μ•‘νŠΈ κ°œλ°œν™˜κ²½μ΄ μ‹€ν–‰λ˜λ©° 코딩을 ν•  수 μžˆλŠ” ν™˜κ²½μ΄ λ™μž‘ν•¨.
    • 3000번 ν¬νŠΈμ— λ¦¬μ•‘νŠΈκ°€ 싀행됨
  • npm run build
    • Bundles the app into static files for production.
    • build
      • λ°°ν¬νŒμ„ λ§Œλ“œλŠ” κ³Όμ •
    • npx serve -s build
      • buildν•œ κ²°κ³Όλ₯Ό μ„œλΉ„μŠ€ν•  λ•Œ serve라고 ν•˜λŠ” app을 μ“°κ² λ‹€
        • serveλŠ” μ›Ή μ„œλ²„.
          • -s : μ‚¬μš©μžκ°€ μ–΄λ–€ 경둜둜 λ“€μ–΄μ˜€λ“  index.html νŒŒμΌμ„ μ„œλΉ„μŠ€ν•œλ‹€.
          • -s build : build 폴더 μ•ˆμ˜ index.html νŒŒμΌμ„ μ„œλΉ„μŠ€ν•œλ‹€.
  • npm test

μˆ˜μ •

  • react-app/src/index.js
    • μž…κ΅¬ 파일
    • npm start λ₯Ό ν•΄μ„œ create-react-app 을 κ΅¬λ™μ‹œν‚€λ©΄ index.js λ₯Ό μ°Ύκ³  거기에 μ ν˜€μžˆλŠ” λŒ€λ‘œ λ™μž‘ν•¨