createAction not accepting null as second argument
See original GitHub issueI have just tried to v1.0.1
and I am getting this error stack.
Throws this error stack
Failed loading boot script: /home/stuart/freecodecamp/server/boot/react.js
Invariant Violation: Expected payloadCreator to be a function or undefined
at invariant (/home/stuart/freecodecamp/node_modules/invariant/invariant.js:42:15)
at createAction (/home/stuart/freecodecamp/node_modules/redux-actions/lib/createAction.js:30:27)
at Object.<anonymous> (/home/stuart/freecodecamp/common/app/redux/actions.js:24:27)
at Module._compile (module.js:570:32)
at loader (/home/stuart/freecodecamp/node_modules/babel-register/lib/node.js:144:5)
at Object.require.extensions.(anonymous function) [as .js] (/home/stuart/freecodecamp/node_modules/babel-register/lib/node.js:154:7)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Function._load (/home/stuart/freecodecamp/node_modules/pmx/lib/transaction.js:62:21)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/home/stuart/freecodecamp/common/app/routes/challenges/components/map/Challenge.jsx:12:1)
at Module._compile (module.js:570:32)
at loader (/home/stuart/freecodecamp/node_modules/babel-register/lib/node.js:144:5)
at Object.require.extensions.(anonymous function) [as .jsx] (/home/stuart/freecodecamp/node_modules/babel-register/lib/node.js:154:7)
Invariant Violation: Expected payloadCreator to be a function or undefined
at invariant (/home/stuart/freecodecamp/node_modules/invariant/invariant.js:42:15)
at createAction (/home/stuart/freecodecamp/node_modules/redux-actions/lib/createAction.js:30:27)
at Object.<anonymous> (/home/stuart/freecodecamp/common/app/redux/actions.js:24:27)
at Module._compile (module.js:570:32)
at loader (/home/stuart/freecodecamp/node_modules/babel-register/lib/node.js:144:5)
at Object.require.extensions.(anonymous function) [as .js] (/home/stuart/freecodecamp/node_modules/babel-register/lib/node.js:154:7)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Function._load (/home/stuart/freecodecamp/node_modules/pmx/lib/transaction.js:62:21)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/home/stuart/freecodecamp/common/app/routes/challenges/components/map/Challenge.jsx:12:1)
at Module._compile (module.js:570:32)
at loader (/home/stuart/freecodecamp/node_modules/babel-register/lib/node.js:144:5)
at Object.require.extensions.(anonymous function) [as .jsx] (/home/stuart/freecodecamp/node_modules/babel-register/lib/node.js:154:7)
The actions causing the error are in this format
export const toggleMapDrawer = createAction(
types.toggleMapDrawer,
null,
() => createEventMeta({
category: 'Nav',
action: 'toggled',
label: 'Map drawer toggled'
})
);
Any advice would be greatly appreciated
Issue Analytics
- State:
- Created 7 years ago
- Comments:7
Top Results From Across the Web
Redux Toolkit: How to refer action created with createAction ...
To have a saga listen to the action. Saga Effects accept string type of an action to react. Luckily, actionCreators expose a type...
Read more >createAction - Redux Toolkit
To do this, createAction accepts an optional second argument: a "prepare callback" that will be used to construct the payload value.
Read more >ArgumentException Class (System) - Microsoft Learn
ArgumentNullException whenever null is passed to a method that does not accept it as a valid argument. ArgumentOutOfRangeException when the value of an ......
Read more >Chapter 11 Creating Actions and Data Types Using Create ...
If the application requires a non-file argument, you cannot use Create Action to create the action. The types of data files an application...
Read more >Different Ways to Dispatch Actions with Redux - Pluralsight
The second argument to connect is the function mapDispatchToProps, ... The above implies that we do not need to dispatch our actions.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
v1.1.0
is out, and supportsnull
payload creators once again.@Bouncey Thanks for pointing this out.