본문 바로가기

전체 글

(351)
기업 코테 풀이 #1. function make_not_continue_number(arr) { var answer = [arr[0]]; for (var i=1; i< arr.length; i++) { var top = answer[answer.length-1]; if (top !== arr[i]) { answer.push(arr[i]) } } return answer; } function solution(s) { var answer = ''; var key_pad = {1: ['.', 'Q', 'Z'], 2: ['A', 'B', 'C'], 3: ['D', 'E', 'F'], 4: ['G', 'H', 'I'], 5: ['J', 'K', 'L'], 6: ['M', 'N', 'O'], 7: ['P', 'R', 'S'], 8..
[Vue3] emits 받는 방법 방법 1. @test_time_result_render=" (v) => { test_time_result_render_toggle = v; } " 방법2. @test_timer_result_render="test_timer_result_render_deliver"
에디터 quill Events text-change Emitted when the contents of Quill have changed. Details of the change, representation of the editor contents before the change, along with the source of the change are provided. The source will be "user" if it originates from the users. For example: User types into the editor User formats text using the toolbar User uses a hotkey to undo User uses OS spelling correction Chang..
웹팩, 툴링, 트랜스파일
'css' 속성이 없습니다.ts(2322) @types/react/index.d.ts의 HTMLAttributes interface에 css 속성이 없는데, 추가하려고 하니 타입 에러가 발생 (해당 코드: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/react/index.d.ts#L1843-L1909) 해결 방법 1. tsconfig.json > compileOptions 에 types 추가 // tsconfig.json { "compilerOptions": { "types": ["@emotion/react/types/css-prop"] } } 2. styles.d.ts 추가 styled.d.ts 파일을 추가하고, 아래 코드를 추가 /// emotion 공식 홈페이지 설명
tsx로 컴포넌트를 만들고 png이미지를 import할때 오류 해결 방법 webpack에서 이미지도 번들링 해주려고, 아래와 같이 설정을 해주니 typescript 쪽에서 해당 에러가 발생했다. // webpack.config.js ... { test: /\.(png|jpe?g)$/, use: { loader: 'file-loader', options: { name: '[path][name].[ext]', }, }, }, ... TS2307: Cannot find module './이름.png' or its corresponding type declarations. 원인은 타입이 정의되어 있지 않아서 이다. Typescript에서 .d.ts 파일을 추가해줘서 타입을 추가할 수 있다. (단, index.d.ts 파일은 index.ts 파일이 생성했다고 Typescript가 추측..
'{ children: never[]; }' 유형에 'IntrinsicAttributes' 유형과 공통적인 속성이 없습니다.ts(2559) TypeScript 에러 발생 Styled-Component를 활용해서 하든 emotion을 사용하든.. 알맞게 css를 적용하고 사용하려고 하는데... /** @jsxImportSource @emotion/react */ import React from 'react' import {css} from '@emotion/react' const LoadingBlock = (props: any) => { const whiteStyle = css` position: absolute; left: 0; top: 0; bottom: 0; right: 0; background: #A4A4A4; display: flex; flex-direction: column; justify-content: center; align-..
리액트 커스텀 훅 만들기 Custom Hooks? 컴포넌트를 만들다 보면 반복되는 로직이 자주 발생된다. 따라서 custom hooks를 만들어서 반복되는 로직을 쉽게 재활용 할 수 있다. Custom Hooks는 "use"라는 단어로 시작한다. (ex: useFetch) useFetch 만들기 기존에 사용했던 fetch는 아래처럼 모든 component에 사용해야했다. const [sources, setSources] = useState([]); useEffect(() => { fetch('data/movieCarouselData.json', { method: 'GET', }) .then(res => res.json()) .then(data => { setSources(data); }); }, []); 하지만 custom ho..

728x90