Pass store as third argument to the event handler
See original GitHub issueCurrently if you want to dispatch an event from inside an event handler you need to have the store on scope by using a closure. If I want to have my event handler in a separate file, then I cant use closures to have access to the store. A way of solving this is by passing the store as the third argument to the event handler, something like
type EventHandler<State,Event> = (currentState: State, event: Event, store: Store) => Partial<State> | undefined
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Day 10: Passing Arguments to Event Handler in React - Medium
We will see that below in our example. There are two ways to pass arguments, via the Arrow function and the Bind method....
Read more >To pass a parameter to event listener in AS3 the simple way ...
Passing a parameter directly to the event handler is not possible. The best approximation is by using a function factory method, IMO.
Read more >Passing Arguments to Event Listeners in JavaScript
Passing arguments to an event handler can be particularly useful when the handler is reused for different events. For example, we want to...
Read more >Passing Arguments to Event Handlers - TutorialsWebsite
Passing arguments to event handler Using Bind Function or Method. You don't need to pass “e” (React Event Object) as an argument. With...
Read more >AWS Lambda function handler in Node.js
The runtime passes three arguments to the handler method. The first argument is the event object, which contains information from the invoker.
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 Free
Top 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
The fix was released in 3.1
PR #130