본문 바로가기

basic/React.js

(42)
Uncaught Error: Expected the reducer to be a function. createStore에서 리듀서 넘겨줄때 문제가 생겼다는것
React Hooks useEffect 제대로 알고 쓰기 1 2 3 4 5 useEffect( () => console.log("mount"), [] ); useEffect( () => console.log("data1 update"), [ data1 ] ); useEffect( () => console.log("any update") ); useEffect( () => () => console.log("data1 update or unmount"), [ data1 ] ); useEffect( () => () => console.log("unmount"), [] ); 1. virtual dom에 마운트되고서 2. 배열 안의 값이 변경 되었을때 업데이트 3. 다시 랜더링 될때 마다 4. 배열 안의 값이 변경되었거나 언마운트 될 때 cleanup함수 실행 5. 언..
Failed to load config "react-app" to extend from. eslint적용시 config모듈을 설치하지 않아서 발생하는것 같다. eslint-config-react-app 또는 eslint-config-airbnb를 입맛에 맞게 설치하면 된다. 설치 후에는 extends에 react-app을 추가해주면 된다.
[Error] Could not find a declaration file for module 'react' npm i --save @types/react @types/react-dom 설치하면됨
[React.js] withRouter react-router-dom 라우트가 아닌 컴포넌트에서 라우터에서 사용하는 객체 location, match, history 를 사용하려면, withRouter 라는 HoC 를 사용해야한다.
[React.js] redux sample //액션 export const ACTION_TYPE = 'ACTION_TYPE'; //액션 생성 함수 export function addAction(text) { return { type: ACTION_TYPE, text, } } //리듀서 함수 function act(state = initialState, action) { if (action.type === 'ACTION_TYPE') { return { text: action.text } } return state; } redux-actions 모듈 사용시 //액션 const ACTION_TYPE = 'ACTION_TYPE'; //액션 생성함수 export const ACTION_TYPE = createAction('ACTION_TYPE', text..
[React.js] CDN 리액트 프로젝트에 적용하기 (다음 주소 API) 1. CDN 스크립트 태그를 index.html에 넣어준다. 2. 주소 API를 부르는 함수 위에 const daum = window.daum; 이걸 추가 해주면 바로 적용되는 것을 볼 수 있다.
Mob X woowabros.github.io/experience/2019/01/02/kimcj-react-mobx.html React에서 Mobx 경험기 (Redux와 비교기) - 우아한형제들 기술 블로그 안녕하세요 딜리버리플랫폼팀 김찬정입니다. woowabros.github.io velog.io/@zoeyul/MobX MobX : Hooks와 함께 사용하기 ✔️ 여기서는 MobX를 클래스형이 아닌 함수형 컴포넌트에서 Hooks, 그리고 Context API와 함께 사용하는 방법을 정리한다. 먼저 MobX와 함께 사용될 Context API에 대하여 알아보도록 하자. Context 주로 어 velog.io mobx.js.org/react-integration.html React integration · MobX ..