Mỗi store trong Redux đều có phương thức dispatch
giúp gửi đi một action cho reducer. Sau khi action được gửi cho reducer, reducer sẽ xử lý và lưu state mới vào store.
Có thể xem việc dispatch một action cũng giống như việc ta trigger một sự kiện.
Ví dụ, cho action sau:
const increment = {
type: "counter/increment",
payload: 1
}
Để dispatch action trên, ta cần truyền nó vào phương thức dispatch
của store
như sau:
store.dispatch(increment)
Related
list
from [[Redux Dispatch Method]]
sort file.ctime asc