So I'm following the getting started guide for Redux Form and I've stumbled on this:
handleSubmit = (values) => { ... }
Intuitively I would think that it compiles to something as simple as this:
function handleSubmit(values) { ... }
But it does not. In reality it compiles to this:
handleSubmit = function handleSubmit(values) { ... };
This makes my JSlint go crazy (error Parsing error: Unexpected token =
), though. And I've tried numerous ways to rewrite this including using the compiled JS instead, but when I do this I get an error because props cannot be accessed.
Can someone explain to me what is going on?
Here is the stacktrace when I use the compiled JS:
Uncaught TypeError: Cannot read property 'props' of undefined
at handleSubmit (create.js:17)
at doSubmit (handleSubmit.js:42)
at handleSubmit.js:107
at handleSubmit (handleSubmit.js:110)
at Form.submit (reduxForm.js:540)
at Object.ReactErrorUtils.invokeGuardedCallback (ReactErrorUtils.js:70)
at executeDispatch (EventPluginUtils.js:85)
at Object.executeDispatchesInOrder (EventPluginUtils.js:108)
at executeDispatchesAndRelease (EventPluginHub.js:43)
at executeDispatchesAndReleaseTopLevel (EventPluginHub.js:54)
And here is a gist with my Eslint config:
https://gist.github.com/webconsult/62bfa93054f261d92c186d39635f743c