Documentation
¶
Overview ¶
Package store is the dirty part of whole Redux system. But also is the main logic place
The purpose is providing a place that you can just dispatch action to it. Without consider the complex behind it
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is a type manage your data
Usage:
counter := func(state int, payload int) int { return state + payload } store := store.New(counter) store.Dispatch(30) fmt.Printf("%d\n", store.StateOf(counter)) // expected: 30
func (*Store) Dispatch ¶
func (s *Store) Dispatch(action interface{})
Dispatch send action to reducers in Store to update state
In v2, action can be anything you want ¶
For example:
func counter(state, payload int) int { return state + payload }
Action type should be `int`, if you use others type, just use others type
Click to show internal directories.
Click to hide internal directories.