반응형
yarn start error방지
"scripts": {
"start": "PORT=8000 react-scripts start", //PORT=8000 삭제해야 yarn start error안남
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"test:debug": "react-scripts test --env=jsdom --verbose false",
"lint": "eslint src",
"eject": "react-scripts eject"
},
Redux사용을 위한 변경 (Window에서 개발하기 위해서 추가했던 것 같음)
before
import { createStore, applyMiddleware } from 'redux';
import thunkMiddleware from 'redux-thunk';
import cdp from '../reducers';
export default function configureStore (initialState) {
const store = createStore(
cdp,
initialState,
applyMiddleware(thunkMiddleware)
);
return store;
}
↓
after
import { createStore, applyMiddleware, compose(얘도추가함) } from 'redux';
import thunkMiddleware from 'redux-thunk';
import cdp from '../reducers';
export default function configureStore (initialState) {
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;//이부분 추가
const store = createStore(
cdp,
initialState,
composeEnhancers(applyMiddleware(thunkMiddleware))//이부분 추가
);
return store;
}
반응형
'js' 카테고리의 다른 글
page redirect 방법들 (0) | 2020.04.12 |
---|---|
ES6(2015) - import/export (0) | 2020.03.24 |
eslint, prettier (0) | 2020.03.18 |
javascript timezone (0) | 2020.03.15 |
Promise, async, await... (0) | 2020.01.02 |