Skip to content

chinsun9/react-banner-maker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

13 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

react-banner-maker

  • Banner Maker์„ ๋ณด๊ณ  ๋งŒ๋“ค์–ด ๋ณด์•˜์Šต๋‹ˆ๋‹ค.
  • html๋กœ๋งŒ ๋งŒ๋“  html-banner-maker๋ฅผ ๋ฆฌ์•กํŠธ๋ฅผ ์‚ฌ์šฉํ•ด์„œ ๋‹ค์‹œ ๋งŒ๋“ค์–ด ๋ณด์•˜์Šต๋‹ˆ๋‹ค.

๋ฐ๋ชจ

๊ธฐ๋Šฅ

  • ์บ”๋ฒ„์Šค ํฌ๊ธฐ ์กฐ์ ˆ
  • ์‹ค์‹œ๊ฐ„ ์บ”๋ฒ„์Šค ์—…๋ฐ์ดํŠธ
  • ํฐํŠธ ์‚ฌ์ด์ฆˆ ์กฐ์ ˆ
  • ํฐํŠธ์ƒ‰ ์กฐ์ ˆ
  • ์บ”๋ฒ„์Šค์ƒ‰์— ๋”ฐ๋ฅธ ํฐํŠธ์ƒ‰ ์ž๋™์กฐ์ ˆ
  • ์บ”๋ฒ„์Šค์ƒ‰ ์กฐ์ ˆ
  • ๋žœ๋ค ์บ ๋ฒ„์Šค์ƒ‰
  • ์ด๋ฏธ์ง€๋กœ ๋‹ค์šด๋กœ๋“œ
  • ํด๋ฆฝ๋ณด๋“œ๋กœ ์นดํ”ผ
  • ์ปฌ๋Ÿฌ ํžˆ์Šคํ† ๋ฆฌ ๊ธฐ๋Šฅ
  • ์ปฌ๋Ÿฌ ํžˆ์Šคํ† ๋ฆฌ ์ž„ํฌํŠธ, ์ต์ŠคํฌํŠธ ๊ธฐ๋Šฅ



create-react-app์œผ๋กœ ํ”„๋กœ์ ํŠธ ์ƒ์„ฑ

npx create-react-app . --typescript
yarn add redux react-redux @types/react-redux

yarn add typesafe-actions

yarn add typesafe-actions
  • typesafe-actions ์„ค์น˜ํ•ด์„œ ์•ก์…˜๊ณผ ๋ฆฌ๋“€์„œ ํŽธํ•˜๊ฒŒ ๋งŒ๋“ค๊ธฐ

ํ”„๋กœ์ ํŠธ๋ฅผ ์ง„ํ–‰ํ•˜๋ฉด์„œ ๊ฒช์€ ๋ฌธ์ œ๋“ค..

parsing error: cannot read property 'name' of undefined

export { default } from './reducer';
export * from './actions';
export * from './types';
  • ํŒŒ์ผ ๋ถ„๋ฆฌ๋ฅผํ•  ๋•Œ ์œ„ ๋ฌธ๋ฒ•์—์„œ lint ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ•œ๋‹ค.
  • ๊ธฐ์กด yarn.lockํŒŒ์ผ์„ ์‚ญ์ œํ•œ๋‹ค.
  "devDependencies": {
    "@typescript-eslint/eslint-plugin": "^2.23.0",
    "@typescript-eslint/parser": "^2.23.0"
  },

useEffect ์‚ฌ์šฉํ•ด์„œ Canvas ์ดˆ๊ธฐํ™” ๋ฐ ์—…๋ฐ์ดํŠธ ํ•˜๊ธฐ

  • useEffect๋ฅผ ์‚ฌ์šฉ์•ˆํ•˜๋‹ˆ๊นŒ ์ฒ˜์Œ ์›น์„ ๋กœ๋”ฉํ–ˆ์„๋•Œ ์บ”๋ฒ„์Šค ์ดˆ๊ธฐํ™”๋ฅผ ๋ชปํ•˜๋Š” ๋ฌธ์ œ๊ฐ€ ์žˆ์—‡๋‹ค.

Type 'boolean' is not assignable to type 'never'.ts(2322)

       const offsets = lines
          .map((_line, index) => index)
          .reduce((prev, curr) => {
            const subtract = curr - mid;
            prev.push([subtract < 0, parseInt(subtract.toString(), 10)]);
            return prev;
          }, new Array<[boolean, number]>());
  • prev.push ํ•˜๋Š” ํƒ€์ž…์— ๋งž๊ฒŒ ๋ฐฐ์—ด์„ ์„ ์–ธํ•ด ๋„ฃ์–ด์ค˜์•ผํ•œ๋‹ค.

react Object is possibly 'null'. useref

const canvas = canvasRef.current;

const canvas = (canvasRef as any).current;
  • ์œ„์ฒ˜๋Ÿผ ํ•˜๋‹ˆ๊นŒ ์•ˆ๋ฌ๋Š”๋ฐ, ์•„๋ž˜์ฒ˜๋Ÿผ ํ•˜๋‹ˆ๊นŒ ๋ฌ๋‹ค.

reactcss Type '{ position: string; zIndex: string; }' is not assignable to type 'CSSProperties'. Types of property 'position' are incompatible.

      popover: {
        position: 'absolute',
        zIndex: 3 ,
      }  as CSSProperties,
  • as CSSProperties๋ฅผ ๋ถ™์—ฌ์ฃผ๋‹ˆ๊นŒ ์ž˜ ์ ์šฉ๋˜์—ˆ๋‹ค.
  • ๋˜ zIndex์˜ ๊ฐ’์€ number๋กœ ์ค˜์•ผํ•œ๋‹ค.

๋ฆฌ์•กํŠธ ํƒ€์ž…์Šคํฌ๋ฆฝํŠธ์—์„œ ํ”„๋ฆฌํ‹ฐ์–ด ์ ์šฉํ•˜๊ธฐ

  "[typescript]": {
    "editor.formatOnSave": true,
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[typescriptreact]": {
    "editor.formatOnSave": true,
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  • ์ €์žฅํ• ๋•Œ ์ž๋™์œผ๋กœ ํฌ๋งทํŒ…ํ• ๋ ค๋ฉด formatOnSave, defaultFormatter๋ฅผ ์ง€์ •ํ•ด์ค˜์•ผํ•œ๋‹ค.

์ปฌ๋Ÿฌํ”ฝ์ปค ์•ŒํŒŒ๊ฐ’ ๋ชป๋ฐ”๊พธ๋Š” ๋ฌธ์ œ