- RecoilRoot aus _app.js entfernt - recoil aus package.json & package-lock.json gelöscht - README.md aktualisiert: Redux statt Recoil - DataSheet.md & Wiki.md angepasst - Projekt ist jetzt vollständig Recoil-frei
29 lines
729 B
JavaScript
29 lines
729 B
JavaScript
// /redux/slices/currentPoiSlice.js
|
|
import { createSlice } from "@reduxjs/toolkit";
|
|
|
|
const initialState = {
|
|
currentPoi: null,
|
|
};
|
|
|
|
const currentPoiSlice = createSlice({
|
|
name: "currentPoi",
|
|
initialState,
|
|
reducers: {
|
|
setCurrentPoi(state, action) {
|
|
state.currentPoi = action.payload; // Zustand mit dem neuen POI aktualisieren
|
|
},
|
|
clearCurrentPoi(state) {
|
|
state.currentPoi = null; // Zustand auf null zurücksetzen
|
|
},
|
|
},
|
|
});
|
|
|
|
// Actions exportieren
|
|
export const { setCurrentPoi, clearCurrentPoi } = currentPoiSlice.actions;
|
|
|
|
// Selector exportieren (optional)
|
|
export const selectCurrentPoi = (state) => state.currentPoi.currentPoi;
|
|
|
|
// Reducer exportieren
|
|
export default currentPoiSlice.reducer;
|