본문 바로가기
에러

[RTK] Redux Toolkit 사용할 때 state값 proxy로 나올 때 해결법

by 박헹구 2022. 5. 29.
반응형

RTK를 사용할 때 state값이 proxy로 나온다면 

 

import { createSlice, current } from "@reduxjs/toolkit";

...

console.log(current(state.data));

current를 붙여서 확인하면 데이터가 제대로 나온다. 

 

 

 

 

 

https://stackoverflow.com/questions/64586207/redux-toolkit-state-showing-as-proxy-undefined-within-reducer

 

Redux Toolkit: state showing as Proxy / undefined within reducer

Solved it, thanks! - For anyone interested, I was trying to access state.tasks.data within the reducer however due to scope, I could access it via state.data as I was already within the tasks slice.

stackoverflow.com

 

반응형

댓글