React 에서 Vue.js 의 반응형 객체(Reactive, Ref) 구현해 보기 (With proxy)
React에서 상태를 관리할 때 항상 setState를 직접 호출해야 값이 변경된다.React는 불변성(immutability)을 기본 철학으로 삼고 있으며, 명시적으로 상태를 변경하는 구조가 핵심 이기 때문이다.하지만 Vue.js를 써본 사람이라면, Vue(3)의 ref()나 reactive()처럼 값을 직접 변경하면 반응적으로 UI가 갱신되는 구조가 더 직관적이고 편리하게 느껴질 수도 있다. 예를 들어, Vue(3)에서는 아래처럼 쓸 수 있다.const state = reactive({ count: 0 });state.count++; // 자동으로 반응! React에서도 이런 방식으로 상태를 관리해보고 싶다는 생각이 들어,Proxy 객체를 활용해 Vue처럼 동작하는 useReactive 훅을 구현..
프론트엔드
2025. 3. 21. 12:22
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- 394. decode string js
- react ref reative
- react 3d
- react glsl
- [leetcode] 394. decode string
- ts glsl
- 394. decode string javascript
- leva
- react vue
- Vue.js
- typescript gsls
- vue ref
- react 3d 에니메이션
- react three fiber leva
- vue reactive
- [leetcode] 394. decode string js
- react leva
- vue3
- vue react
- eslint
- vue
- next.js import glsl
- attempted import error: bvh_struct_definitions' is not exported from './gpu/bvhshaderglsl.js' (imported as 'bvhshaderglsl').
- three.js leva
- react three fiber
- 394 decode string
- react 3d animation
- webpack glsl
- react 3d text
- react fiber 3d
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
글 보관함