(amount)
| 64 | // We can also write thunks by hand, which may contain both sync and async logic. |
| 65 | // Here's an example of conditionally dispatching actions based on current state. |
| 66 | export const incrementIfOdd = (amount) => (dispatch, getState) => { |
| 67 | const currentValue = selectCount(getState()); |
| 68 | if (currentValue % 2 === 1) { |
| 69 | dispatch(incrementByAmount(amount)); |
| 70 | } |
| 71 | }; |
| 72 | |
| 73 | export default counterSlice.reducer; |
no test coverage detected