Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- export const DELETE_SLIDE = 'DELETE_SLIDE'
- export const deleteSlide = index => ({
- type: DELETE_SLIDE,
- index
- })
- export const slideReducer = (state, action) => {
- // ... normal stuff
- case DELETE_SLIDE:
- return {
- ...state,
- slides: state.slides.filter(slide => slide.id !== action.index),
- currentSlide: state.currentSlide === 0 ? 0 : state.currentSlide - 1
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement