Title: Support being reducer function passed to React’s `useReducer` accepting an event as action · Issue #32 · JavaScriptRegenerated/yieldmachine · GitHub
Open Graph Title: Support being reducer function passed to React’s `useReducer` accepting an event as action · Issue #32 · JavaScriptRegenerated/yieldmachine
X Title: Support being reducer function passed to React’s `useReducer` accepting an event as action · Issue #32 · JavaScriptRegenerated/yieldmachine
Description: function reducer(previousState: State, event: React.FormEvent
Open Graph Description: function reducer(previousState: State, event: React.FormEvent
X Description: function reducer(previousState: State, event: React.FormEvent<HTMLFormElement> | React.MouseEvent<HTMLButtonElement>): State { return previousState.machine.next(event); } eventsReducer(...
Opengraph URL: https://github.com/JavaScriptRegenerated/yieldmachine/issues/32
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Support being reducer function passed to React’s `useReducer` accepting an event as action","articleBody":"```ts\r\nfunction reducer(previousState: State, event: React.FormEvent\u003cHTMLFormElement\u003e | React.MouseEvent\u003cHTMLButtonElement\u003e): State {\r\n return previousState.machine.next(event);\r\n}\r\n```\r\n\r\n## `eventsReducer(machine)`\r\n\r\nIt wouldn’t support side effects and listening/emitting to events (e.g. with `listenTo()`).\r\n\r\n```js\r\nimport { eventsReducer } from 'yieldmachine';\r\n\r\nfunction useMachine(machine) {\r\n const [state, dispatch] = useReducer(eventsReducer(machine));\r\n return [state, dispatch];\r\n}\r\n```","author":{"url":"https://github.com/RoyalIcing","@type":"Person","name":"RoyalIcing"},"datePublished":"2021-11-11T00:45:35.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/32/yieldmachine/issues/32"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:15302b9e-ecab-8b91-babc-598a4a39b073 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9942:B4049:D58A97:1118C9D:6974623C |
| html-safe-nonce | cbd75b1786d01e850d3d186b834c5bb7933287e80c2201a57b9fcf15f0c62be7 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5OTQyOkI0MDQ5OkQ1OEE5NzoxMTE4QzlEOjY5NzQ2MjNDIiwidmlzaXRvcl9pZCI6IjUyMzQwMjI5MzczOTEyOTI5ODgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | d04987dc103053fe6b6c79cbcf5f590d1b047f8557cfb303c8c3fdb00774c51f |
| hovercard-subject-tag | issue:1050459547 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/JavaScriptRegenerated/yieldmachine/32/issue_layout |
| twitter:image | https://opengraph.githubassets.com/8cd1ddd649e30ed81918dab8f31b634e5aeae719108afa0b11724bf0d28f81f3/JavaScriptRegenerated/yieldmachine/issues/32 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/8cd1ddd649e30ed81918dab8f31b634e5aeae719108afa0b11724bf0d28f81f3/JavaScriptRegenerated/yieldmachine/issues/32 |
| og:image:alt | function reducer(previousState: State, event: React.FormEvent |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | RoyalIcing |
| hostname | github.com |
| expected-hostname | github.com |
| None | e0b95d743b7672c9ac0e1032d5f117950182dc164a83434a7db86510e8f0b37c |
| turbo-cache-control | no-preview |
| go-import | github.com/JavaScriptRegenerated/yieldmachine git https://github.com/JavaScriptRegenerated/yieldmachine.git |
| octolytics-dimension-user_id | 91813245 |
| octolytics-dimension-user_login | JavaScriptRegenerated |
| octolytics-dimension-repository_id | 327153192 |
| octolytics-dimension-repository_nwo | JavaScriptRegenerated/yieldmachine |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 327153192 |
| octolytics-dimension-repository_network_root_nwo | JavaScriptRegenerated/yieldmachine |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 56fe7e2e8de6e57740bca50402351ea656f7a4bf |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width