It is common when you work with redux to define an initial state, eg
const initState = {
pagInicial:1,
pagAtual:1,
maxLinks:2,
maxReg:5
}
So far so good. Now and when I need an initial state, starting with some parameters and calculated fields, for example:
const initState = {
pagInicial:1,
totReg:pegar total registros
pagAtual:1,
maxLinks:2,
maxReg:5,
totLinks:Math.ceil(totReg/maxReg),
regInit:((maxReg*pagAtual)-maxReg),
regFim:(maxReg*pagAtual))
}
TotReg , TotLinks , regInit , regFim , / i> the initial state of these fields?