{"id":14970631,"url":"https://github.com/zmitry/rrethunk","last_synced_at":"2026-02-26T09:45:05.899Z","repository":{"id":110954018,"uuid":"103420844","full_name":"zmitry/rrethunk","owner":"zmitry","description":"simplify your redux boilerplate","archived":false,"fork":false,"pushed_at":"2018-04-26T11:01:31.000Z","size":2044,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-30T23:02:49.389Z","etag":null,"topics":["react","redux","redux-thunk"],"latest_commit_sha":null,"homepage":"https://zhdmitry.github.io/rrethunk","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zmitry.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-09-13T16:01:01.000Z","updated_at":"2018-05-20T11:27:40.000Z","dependencies_parsed_at":null,"dependency_job_id":"34433c3b-886d-4e21-bde6-4dafe118de18","html_url":"https://github.com/zmitry/rrethunk","commit_stats":{"total_commits":21,"total_committers":2,"mean_commits":10.5,"dds":0.09523809523809523,"last_synced_commit":"e42fd270bd0dea354fb86301136faa2c48c33c14"},"previous_names":["zhdmitry/rrethunk"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zmitry%2Frrethunk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zmitry%2Frrethunk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zmitry%2Frrethunk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zmitry%2Frrethunk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zmitry","download_url":"https://codeload.github.com/zmitry/rrethunk/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240221316,"owners_count":19767442,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["react","redux","redux-thunk"],"created_at":"2024-09-24T13:43:53.119Z","updated_at":"2025-11-13T09:04:32.645Z","avatar_url":"https://github.com/zmitry.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n\n## rrethunk\n[![NPM Downloads](https://img.shields.io/npm/dm/rrethunk.svg?style=flat)](https://www.npmjs.com/package/rrethunk)\nhelpers for redux which reduces boilerplate code\n## Actions\n\n```js\n// actions\n\nconst clear = (args)=\u003e{\n    return fetch('api')\n}\n\n// it will resolve this promise\n// and trigger fetchData:busy while primise is loading\n// and fetchData:success when promise is resolved\nconst fetchData = (args) =\u003e (dispatch, getState)=\u003e{\n    return fetch('api')\n}\n\n\nexport const actions = createActions({\n    fetchData,\n    clear\n}, {\n    prefix: '@data/',\n    meta: (args)=\u003e ({ entity: args.entity })\n})\n\ndispatch(actions.fetchData({ entity: 'todo', info: 'bla lba' })) \n/**\n *  =\u003e {type: '@data/fetchData:loading', payload: { entity: 'todo',  info: 'bla lba' }', meta: { entity: 'todo' } }\n *  =\u003e {type: '@data/fetchData:success', payload:  {//thunk result}, meta: { entity: 'todo' } }\n *  or  =\u003e {type: '@data/fetchData:error', payload: {//error result}, meta: { entity: 'todo' } }\n *  or  =\u003e {type: '@data/fetchData:canceled', payload: null, meta: { entity: 'todo' } }\n * \n */\nactions.fetchData.error('something happened') =\u003e ({  }) // =\u003e {type: '@data/fetchData:error', payload: 'something happened' }\nactions.fetchData.error('something happened', { user: 21 }) =\u003e ({  }) // =\u003e {type: '@data/fetchData:error', payload: 'something happened', meta: { user: 21 } }\n\n\n// reducer\nimport actions from './actions'\n\n\n\nconst reducer = createReducer({})\n.before(actions.fetchData, (state)=\u003e ({ loading: true }))\n.canceled(actions.fetchData, (state)=\u003e ({}))\n.on(actions.fetchData, (state, payload)=\u003e{\n    return payload.data\n})\n.onError(actions.fetchData, (state)=\u003e ({}))\n\n```\n\n\n## custom combineReducer\n```js\nconst reducer = combineReducer({\n    a: s=\u003es,\n    b: s=\u003es\n}).on(actions.done, (state, action)=\u003e({\n// state is {a, b}; \nreturn { a: state.a }\n}))\n```\n\nalso there is actionState reducer which store state of each action\n\n# how to use\n1. add redux-thunk middleware\n2. just use it as plain actions\n\n# TODO\nthis lib tries to implement common use cases such as \n1. Handling async actions state with constants boilerplate \n2. Handling async actions creation with prefixing and auto meta info\n3. Handling actions canceling, takeLatest, takeFirst\n4. Make reducer more easier to write and enforce you for writing more atomic reducers.\n5. Handling actions transactions and reverting\n\n\n## to read\nthe idea of decoupling async actions and api repository \nhttps://medium.com/@david.losert_73564/dependency-inversion-with-redux-thunk-typescript-e09cebabdc1f\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzmitry%2Frrethunk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzmitry%2Frrethunk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzmitry%2Frrethunk/lists"}