기록중

오늘 만났던 에러코드 및 검색코드(css, react)

lian_is_clone 2021. 12. 15. 22:02

검색한 문법

1. nth-last-child(n+3)

- 선택한 input테그 중에서 마지막 두번째 전 까지만 선택하고 싶어 찾았었다.

2. liquid object 

- fillter 중 append

3. 버튼을 눌렀을 때 이전 페이지로 이동하고 싶어 검색하였다.

해결방법 : href="javascript:history.back()" 을 입력하라고 하네요.

4. js = str.substring(index,index) / js = str.indexOf('str')

상품 옵션이 label로 표현되는데 표시하고 싶지 않는 정보가 같이 표현되어있었다.

간단하게 엡게발자에게 물어보니 정보삭제는 불가능하다고 그냥 쓰라고 하여 펑션 제작에 들어갔다.

간단하게 document.querySelectorAll('lablel')로 모든 라벨을 모아오고 forEach문을 돌렸다.

var testlist = document.querySelectorALL('label')

testlist.forEach(list =>{
    var temp = list.innerHTML.substring(0,list.innerHTML.indexOf('-'));
    list.innerHTML = temp;
})

이러니 해결 끝.

 

에러난 것

1. 별거아닌 임포트 후 api이름 오타

2. SyntaxError: C:\Users\GNsys\Desktop\JHcompany\Ldiablo\noddJS\FullStackMERNProject\client\src\App.js: Identifier 'useEffect' has already been 
declared. (12:9)

그냥 두번선언되었다고 한다.......

3. 이번엔 

TypeError: Cannot call a class as a function

_classCallCheck
C:/Users/GNsys/Desktop/JHcompany/Ldiablo/noddJS/FullStackMERNProject/client/node_modules/react-thunk/dist/commonjs/index.js:15

이란다 무슨일일까

thunk 를 react-thunk로 썻는데 redux-thunk로 쓰렌다 무슨차이지...

 

4. 고치면 또 나오네 고치면 또나오고

Error: Actions must be plain objects. Instead, the actual type was: 'Promise'. You may need to add middleware to your store setup to handle dispatching other values, such as 'redux-thunk' to handle dispatching functions. See https://redux.js.org/tutorials/fundamentals/part-4-store#middleware and https://redux.js.org/tutorials/fundamentals/part-6-async-logic#using-the-redux-thunk-middleware for examples.

무슨 문제인지 모르고 다른 에러로 변경되었다 이건 임포트가 안되었다는거라 수정해보겠다.

문제는 export default reduser = combineReducers({ posts }); 이였는데

깃헙가니 default가 const 로 바뀌어있었다.

그리고 또 에러

ReferenceError: reducer is not defined
Module.<anonymous>

Error: Actions must be plain objects. Instead, the actual type was: 'Promise'. You may need to add middleware to your store setup to handle dispatching other values, such as 'redux-thunk' to handle dispatching functions. See https://redux.js.org/tutorials/fundamentals/part-4-store#middleware and https://redux.js.org/tutorials/fundamentals/part-6-async-logic#using-the-redux-thunk-middleware for examples.

 

꼬리에 꼬리

미들웨어 어렵다...

 

클론코딩 여기 보고있습니다.

https://www.youtube.com/watch?v=ngc9gnGgUdA&t=2311s