State
https://ko.reactjs.org/docs/faq-state.html
컴포넌트 State – React
A JavaScript library for building user interfaces
ko.reactjs.org

얕은 복사, 깊은 복사

<script>
//1. 얕은 복사,원시타입
let a = "ggombee";
let b = a;
a = "sara";
document.write(a + "<br>"); //sara
document.write(b + "<br>"); //ggombee
//2. 깊은 복사,참조타입
let profileA = { name: "ggombee" };
let profileB = profileA;
profileA.name = "sara";
document.write(profileA.name + "<br>"); //sara
document.write(profileB.name + "<br>"); //sara
</script>
'React' 카테고리의 다른 글
| React-Hooks 사용하기(5) (0) | 2023.02.08 |
|---|---|
| React-components&Props(3) (0) | 2023.02.07 |
| React-Virtual DOM(2) (0) | 2023.02.02 |
| React-웹사이트에 React추가하기&JSX(1) (0) | 2023.02.02 |