Web/React 3

Parsing error: Cannot read property 'name' of undefined 에러 해결하기

export \* from './BoardRow'; 이런식으로 전체를 export하면 에러를 발생시키는 경우가 있다. Parsing error: Cannot read property 'name' of undefined 에러 해결 방법 1번 ts 버젼이 3.7이면 eslint 2.23으로 다운그레이드 한다. "@typescript-eslint/eslint-plugin": "^2.23.0", "@typescript-eslint/parser": "^2.23.0", 2번 ts를 3.8로 업데이트 한다. 참고 https://github.com/typescript-eslint/typescript-eslint/issues/1746

Web/React 2020.04.22

[React] context api - provider

위 그림 처럼 A라는 컴포넌트에 monet르 d에게 전달하기 위해서는 A -> B - C -> D로 전달해야한다. children의 children의 children... 에게 계속 전달해주게 되면 props drilling 현상이 된다. react 16.3부터는 context api를 제공하는데 이것을 해결할 수 있다. ## 정리 - 어떤 특정값만 보내는게 아니라, 특정 컴포넌트 메소드도 넘길수 있으므로 활용하면 좋다. - 예) React native에서 portal을 구현할 때, 위에 방식처럼 구현하면 편하다. https://www.toptal.com/react/react-context-api Working with the React Context API The React Context API was..

Web/React 2020.01.11

React JSX에 대해서 알아봅시다.

React JSX에 대해서 알아봅시다.요약JSX안에 함수식으로 사용 가능합니다.camelCase로 써야합니다. ( JSX는 html보다 Javascript에 가깝다. )Injection Attack을 막아줍니다. ( XSS )JSX안에 함수식으로 사용가능. Hello, {formatName(user)}!부분을 보시면 formatName 함수를 호출하여 구현이 가능합니다.function formatName(user) { return user.firstName + ' ' + user.lastName; } ​ const user = { firstName: 'Harper', lastName: 'Perez' }; ​ const element = ( Hello, {formatName(user)}! ); ​ Reac..

Web/React 2019.03.19