Ich versuche, eine .map
Funktion in einen Zustand Array in Redux mit Typoskript zu tun, ist das Problem, dass esProperty-ID auf Typ existiert nicht ‚nie‘
[ts] Property ein Fehler vorliegt werfen ' id‘existiert nicht auf Typ‚nie‘
in der landing.id
if-Anweisung, da seine ein Array von Objekten der Code für mich Sinn macht, aber scheint, dass ich etwas fehlt es
export default function landingReducer (state = [], action) {
switch(action.type) {
case ActionTypes.ADD_LANDING:
return [...state, action.landing]
case ActionTypes.EDIT_LANDING:
return state.map(landing => {
if (action.landing.id == landing.id) {
return landing;
}
})
Vielen Dank im Voraus!
wirklich zu schätzen, es funktionierte gut und gelöst mir auch einige Fragen, die ich hatte über Typoskript (ich damit fange). Danke, Mann! –