input값을 넘긴 후 input값을 초기화하려고 하는데 오류가 남! class addForm extends Component { inputRef = createRef(); addHabit = (e) => { e.preventDefault(); const name = this.inputRef.current.value; this.props.addHabit(name); this.inputRef.current.reset(); }; ...... this.inputRef.current.reset is not a function this.inputRef.current.reset는 함수가 아니다 왜..? reset()은 있는 건데... 왜...? input에는 reset()을 사용할 수 없다 input을 감싸고 있는..
habits라는 배열에서 받아온 habit이라는 인자와 id가 같으면 count를 내려주는 로직을 짜고 싶은데 handleDecrement = (habit) => { const habits = this.state.habits.map((item) => { if (item.id === habit.id) { const count = habit.count - 1; return { ...habit, count: count < 0 ? 0 : count }; } }); this.setState({ habits }); }; 이렇게 쓰면 에러가 남 Array.prototype.map() expects a value to be returned at the end of arrow function map()은 화살표 함수의 ..
- Total
- Today
- Yesterday
- 구름에듀
- 자바스크립트
- scss
- React
- Python
- 코드잇
- 코딩앙마
- 비주얼스튜디오코드
- 스파르타코딩클럽
- Typescript
- vue
- 리액트
- 타입스크립트
- 회고
- 드림코딩
- CSS
- map
- 파이썬
- javascript
- js
- Til
- git
- html
- vscode
- 제이쿼리
- 깃
- 제로초
- 김버그
- 저스트코드
- TS
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 | 31 |