Skip to content

Instantly share code, notes, and snippets.

@halfbug
Created November 12, 2020 12:13
Show Gist options
  • Save halfbug/4d50d263a0dc055b30ea5b4de3b418ba to your computer and use it in GitHub Desktop.
Save halfbug/4d50d263a0dc055b30ea5b4de3b418ba to your computer and use it in GitHub Desktop.
import { createSlice } from '@reduxjs/toolkit';
export const initialState = {};
const slice = createSlice({
name: 'lastPropertyId',
initialState,
reducers: {
store(state, action) {
const { payload } = action;
return payload;
},
setLastPropertyId(state, action) {
const { payload } = action;
return { ...state, lastPropertyId: payload };
console.log("setLastPropertyId -> payload", payload)
},
},
});
export const { store, setLastPropertyId } = slice.actions;
export default slice.reducer;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment