Skip to content

Commit

Permalink
Feat: 카테고리 filter 관련 Reducer 생성 (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
ohinhyuk committed Aug 25, 2023
1 parent eb7c478 commit a039d36
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/redux/slices/filter.js
Original file line number Diff line number Diff line change
@@ -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;

0 comments on commit a039d36

Please sign in to comment.