Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F33325964
D11369.1768863931.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
697 B
Referenced Files
None
Subscribers
None
D11369.1768863931.diff
View Options
diff --git a/lib/hooks/ops-hooks.js b/lib/hooks/ops-hooks.js
new file mode 100644
--- /dev/null
+++ b/lib/hooks/ops-hooks.js
@@ -0,0 +1,21 @@
+// @flow
+
+import * as React from 'react';
+
+import type { MessageID } from '../types/db-ops-types.js';
+import type { SuperAction } from '../types/redux-types.js';
+import { useDispatch } from '../utils/redux-utils.js';
+
+function useDispatchWithMessageID(): (
+ action: SuperAction,
+ messageID: MessageID,
+) => mixed {
+ const dispatch = useDispatch();
+ return React.useCallback(
+ (action: SuperAction, messageID: MessageID) =>
+ dispatch({ ...action, messageID }),
+ [dispatch],
+ );
+}
+
+export { useDispatchWithMessageID };
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Jan 19, 11:05 PM (11 h, 49 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5957297
Default Alt Text
D11369.1768863931.diff (697 B)
Attached To
Mode
D11369: [lib] Create a wrapper over dispatch
Attached
Detach File
Event Timeline
Log In to Comment