Redux State Management Techniques

Image for post
Image for post
Pomodoro by Increaser

Introduction

Redux Act

Reducers

src/reducers/index.js
src/reducers/setting.js

Toggle

src/utils/generic.js

Set Value

src/utils/generic.js
[a.requestStatistics]: setValue('requested', true)
[a.changeNewProjectColor]: setValue('newProjectColor')

Connect To

Take From State

// flat state
const { id } = state.user
// deep state(an object inside of an object inside of an object...)
const { id } = state.user.data.infoAnd
takeFromState({
timer: ['duration'],
timeline: ['sets'],
settings: ['tickingSound'],
// collision!
sound: ['duration']
})
src/utils/generic.js
Image for post
Image for post
Increaser

Written by

Software engineer, creator of increaser.org. More at geekrodion.com

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store