From 0c8cd7f7fe620ff81309dccfc08722e1211a1c06 Mon Sep 17 00:00:00 2001 From: Osama Qarem Date: Thu, 18 Jun 2020 23:53:25 +0800 Subject: [PATCH] update: use immer in redux slice --- template/src/redux/slices/exampleSlice.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/template/src/redux/slices/exampleSlice.ts b/template/src/redux/slices/exampleSlice.ts index 4804afe..073d200 100644 --- a/template/src/redux/slices/exampleSlice.ts +++ b/template/src/redux/slices/exampleSlice.ts @@ -17,8 +17,8 @@ const exampleSlice = createSlice({ name: "example", initialState, reducers: { - ping: (state) => ({ ...state, globalValue: 'PING' }), - pong: (state) => ({ ...state, globalValue: 'PONG' }), + ping: (state) => { state.globalValue = 'PING' }, + pong: (state) => { state.globalValue = 'PONG' }, }, })