using Redux
# actionsstruct IncrementAction <:AbstractSyncActionendstruct DecrementAction <:AbstractSyncActionendconst INCREMENT =IncrementAction()
const DECREMENT =DecrementAction()
# statestruct State <:AbstractImmutableState
counter::Intend# reducerscounter(state::AbstractState, action::AbstractAction) = state
counter(state::Vector{<:AbstractState}, action::AbstractAction) = state
counter(state::State, action::IncrementAction) =State(state.counter +1)
counter(state::State, action::DecrementAction) =State(state.counter -1)
# create store
store =create_store(counter, State(0))
# get_state@showget_state(store).counter
# dispatch actiondispatch!(store, INCREMENT)
@showget_state(store).counter
dispatch!(store, DECREMENT)
@showget_state(store).counter
Julia Packages
This website serves as a package browsing tool for the Julia programming language. It works by aggregating various sources on Github to help you find your next package.