분류 전체보기

개발관련/자바스크립트 팁

[JavaScript] encodeURI vs encodeURIComponent 의 차이

encodeURI vs encodeURIComponent 의 차이 디코딩 권장 방법 tryDecode: string => { try { return decodeURIComponent(string) } catch (e) { return unescape(string) } } 특수 문자의 인코딩 포함 여부의 차이이다. encodeURIComponent : 특수 문자 포함 인코딩 encodeURI : 특수 문자 제외 인코딩 디코딩 시 인코딩 타입을 모를 경우 decodeURIComponent 로 할 것을 권장 URI 형식이 아닐 경우(텍스트가 잘린 경우 등) 디코딩시 에러를 반환한다. 그때는 unescape 로 예외 처리 해준다. 아래 링크를 통한 쿠팡 구매 시 블로그를 지속하는 큰 힘이 됩니다. https:/..

개발관련/자바스크립트 팁

[React] Hoc와 render 속성 값 비교

Hoc vs Render 속성 값 컴포넌트에 공통적으로 사용되는 로직을 재사용 가능하도록 구현하는 방법에는 Hoc 와 Prop render 를 사용하는 2가지 방법이 있다. 1. 컴포넌트 내부 일부에서 적용하는 경우 HOC 현재 컴포넌트의 전체에 적용 //HOC //로그인시에만 렌더링하는 HOC const WithIsLogin = WrappedComponent => class WithIsLogin extends Component { state = { isLogin : false } checkIsLogin = ()=> { /***/ } componentDidMount(){ this.setState({ isLogin : this.checkIsLogin() }) } render(){ if(this.state...

개발관련/자바스크립트 팁

MUI 에서 차일드 선택하는 방법 mui styled child selector hover에서 선택하는 방법

const child = styled(div)` opacity: 0; right: 30px; `; const Parent = styled("div")` &:hover { ${CloseBtn} { opacity: 1; } } ${CloseBtn} { width:10px; height:10px; } `;

카테고리 없음

CRA (create react app) eject 하지 않고 babel custom 하는 방법 ( babel plugin 사용하기)

CRA로 작업을 하다 보면 사용하는 모듈 때문에 추가로 babel plugin를 사용해야 되는 경우가 있다. 간단한 프로젝트여서 CRA를 사용했는데 eject하게 되면 귀찮아 진다. 최대한 간단하게 eject하지 않고 babel config를 override해서 babel custom하는 방법이다. npm install react-app-rewired customize-cra --save-dev # or yarn add react-app-rewired customize-cra --dev Install react-app-rewired and customize-cra: 필요한 모듈을 설치해준다. npm install babel-plugin-myPlugin --save-dev # or yarn add babe..

개발관련/자바스크립트 팁

MUI component에서 styled 사용하기

'@mui/styles'는 deprecate '@mui/styles'는 deprecate 됐기 떄문에 더이상 사용하지 않는 것을 권한다. import { styled } from '@mui/styles'; '@mui/system' 대신에 '@mui/system'를 사용하는 것을 권장한다. styled component child selector 옵션을 사용하기 위해서 필요하다. import { styled } from '@mui/system'; babel config 필수 변경된 메소드를 사용하기 위해서 바벨 플러그인 설치가 필수 @emotion/babel-plugin를 설치해준다. npm install @emotion/babel-plugin babel.config.js module.exports = {..

개발관련/자바스크립트 팁

nvm 사용시 node 버전 기본값 변경 하기

node 버전 에러 npm을 통해서 모듈을 설치하다보면 위와 같은 에러 메세지를 보는 경우가 있다. the engine "node" is imcompatible with module. Expected version ">=14.0.0" Got "12.19.0" 내가 설치하고자 하는 모듈의 node 버전과 로컬의 node 버전이 맞지 않아서 생기는 문제이다. ( module의 14버전 이상을 요구하지만 12버전 설치 되어 있는 상태. ) 요즘 라이브러리들이 요구하는 node의 기본 버젼이 대게 14버젼 이상이 많아졌다.( ex. react-dnd) nvm를 사용해서 node 버전을 변경할수 있지만 매번 nvm use 14 를 하는 것이 귀찮아져서 아예 기본 버전으로 14로 변경하는 방법을 공유한다 $ nvm..

카테고리 없음

about Porsche

People usually say that men like cars. but i have no interesting about car literally. except the Porsche. I don't know about the engine or anything like that. One of the reasons I love Porsche. Because of it's classic and elegant design. Another reson is because of the character Ben in the movie Burning. In the movie Burning, Jong-su must finds meaning of life in order to live. For Ben, life is ..

카테고리 없음

You cannot run CocoaPods as root 에러

pod install 할때 You cannot run CocoaPods as root 에러가 발생하면 --allow-root 를 추가하면 된다. pod install --allow-root

개발자 Dane
'분류 전체보기' 카테고리의 글 목록 (12 Page)