~~Everyday, 23 to 24 오늘한거 정리해정리
직접적으로 수정하면 안 되는 이유
1) setState가 비동기적여서 버그가능성
2) PureComponent에서는 동작x -> 얕은 비교때문에
https://velog.io/@jellybrown/ReactJS-%EC%96%89%EC%9D%80-%EB%B3%B5%EC%82%ACShallow-Copy-%EA%B9%8A%EC%9D%80-%EB%B3%B5%EC%82%ACDeep-Copy-%EA%B7%B8%EB%A6%AC%EA%B3%A0-React%EC%9D%98-%EB%A6%AC%EB%A0%8C%EB%8D%94%EB%A7%81
// const handleData = (index) =>(e)=>{
const newData = [...data];
newData[index].message = e.target.value:
setData(newData);
} -> 이렇게 보다
//const handleData= (index) => (e)=>{
setData( preData=>
preData.map((item, dataIndex) => {
if (dataIndex === index) {
return {
...item,
message: e.target.value,
}}
else {
return data;}
}));
} // useCallback 도 써주기
Every Morning
class Counter {
#count=0;
increase(){
this.#count++;
}
}
const counter = new Counter();
counter.increase();
https://developer.mozilla.org/en-US/docs/Web/JavaScript/ClosuresEvery Evening 24 to 2
Monday/ Wednesday/ Thursday (Clarisse랑 날짜 조정하기)
Wednesday/ Saturday
The alarm is ringing🙄
Working out
Keep having that hight spirit and Continue to carry passion in learning😏
클라리스랑 벌써 8?9개월? Time flies sosososososososo fast
Free time