From a039d36b45f6d836dca1aea935a697efb750c0e4 Mon Sep 17 00:00:00 2001 From: ohinhyuk <8156217@naver.com> Date: Fri, 25 Aug 2023 14:41:33 +0900 Subject: [PATCH] =?UTF-8?q?Feat:=20=EC=B9=B4=ED=85=8C=EA=B3=A0=EB=A6=AC=20?= =?UTF-8?q?filter=20=EA=B4=80=EB=A0=A8=20Reducer=20=EC=83=9D=EC=84=B1=20(#?= =?UTF-8?q?15)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/redux/slices/filter.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 src/redux/slices/filter.js diff --git a/src/redux/slices/filter.js b/src/redux/slices/filter.js new file mode 100644 index 0000000..92ed8b4 --- /dev/null +++ b/src/redux/slices/filter.js @@ -0,0 +1,22 @@ +import { createSlice } from '@reduxjs/toolkit'; + +const initialState = { + category: '', +}; + +const slice = createSlice({ + name: 'filter', + initialState, + reducers: { + setFilter: (state, action) => { + state.category = action.payload; + }, + clearFilter: (state) => { + state.category = ''; + }, + }, +}); + +// Reducer +export const { setFilter, clearFilter } = slice.actions; +export default slice.reducer;