1

createActionsを使用すると問題が発生します。 createActionsのみを使用するとすべてが機能しますが、 createActions を使用しようとすると、アプリにエラーが表示されます....

未処理の拒否 (TypeError): オブジェクト (...) は関数ではありません

ディスパッチ メソッドを持つすべての関数で、createAction でのみ機能します

import { createAction, createActions } from 'redux-actions'
// Types
import { ADD_TASK } from '../types/todo.types'
import { SHOW_TASKS } from '../types/todo.types'

// export const addTaskAction = createAction(ADD_TASK)
// export const showAllTasksAction = createAction(SHOW_TASKS)

// * Refactor to createActions

export const { addTaskAction, showAllTasksAction } = createActions(
  ADD_TASK,
  SHOW_TASKS,
)
Unhandled Rejection (TypeError): Object(...) is not a function
_callee$
src/shared/routes/private/PrivateRoutes.routes.js:19
  16 |   getAllTasks()
  17 | }, [])
  18 | 
> 19 | async function getAllTasks() {
     | ^  20 |   const result = await todo.getAllTasks()
  21 |   return dispatch(showAllTasksAction(result))
  22 | }

4

1 に答える 1