{"id":19363084,"url":"https://github.com/wwayne/redux-reset","last_synced_at":"2025-09-01T00:39:48.021Z","repository":{"id":57351373,"uuid":"54787947","full_name":"wwayne/redux-reset","owner":"wwayne","description":"Give redux the ability to reset the state","archived":false,"fork":false,"pushed_at":"2017-11-16T08:20:38.000Z","size":6,"stargazers_count":96,"open_issues_count":3,"forks_count":7,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-11-10T07:39:51.431Z","etag":null,"topics":["javascript","react","redux","state-management"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wwayne.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-03-26T16:24:00.000Z","updated_at":"2024-03-27T06:57:28.000Z","dependencies_parsed_at":"2022-08-31T06:21:38.710Z","dependency_job_id":null,"html_url":"https://github.com/wwayne/redux-reset","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wwayne%2Fredux-reset","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wwayne%2Fredux-reset/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wwayne%2Fredux-reset/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wwayne%2Fredux-reset/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wwayne","download_url":"https://codeload.github.com/wwayne/redux-reset/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224742665,"owners_count":17362232,"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":["javascript","react","redux","state-management"],"created_at":"2024-11-10T07:32:35.113Z","updated_at":"2024-11-18T00:06:52.328Z","avatar_url":"https://github.com/wwayne.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# redux-reset\n[![Version](http://img.shields.io/npm/v/redux-reset.svg)](https://www.npmjs.org/package/redux-reset)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](https://github.com/feross/standard)\n[![Circle CI](https://circleci.com/gh/wwayne/redux-reset/tree/master.svg?style=svg)](https://circleci.com/gh/wwayne/redux-reset/tree/master)\n\n## Installation\n\n```sh\nnpm install redux-reset\n```\n\n## Basic Usage\n1.Setup in createStore\n\n```JavaScript\nimport reduxReset from 'redux-reset'\n...\nconst enHanceCreateStore = compose(\n    applyMiddleware(...),\n    reduxReset()  // Will use 'RESET' as default action.type to trigger reset\n  )(createStore)\nconst store = enHanceCreateStore(reducers)\n```\n\n\n2.Dispatch reset action\n\n```JavaScript\nstore.dispatch({\n  type: 'RESET'\n})\n```\n\n## Advanced Usage\n#### Set any custom action.type to trigger reset\n\n```JavaScript\nimport Enum from 'es6-enum'\nconst APP = Enum('RESET')\n\nconst enHanceCreateStore = compose(\n    applyMiddleware(...),\n    reduxReset(APP.RESET) // Set action.type here\n  )(createStore)\nconst store = enHanceCreateStore(reducers)\n\nAFTER:\nstore.dispatch({\n  type: APP.RESET\n})\n```\n\n#### Reset and specific to a new initial state\n\n```JavaScript\nstore.dispatch({\n  type: 'RESET',\n  state: {app: {user: 'anotherUser'}} // Will use this as new initial state\n})\n```\n\n#### Reset and specific to a new initial state, new state comes from a specific params in action\n\n```JavaScript\nimport Enum from 'es6-enum'\nconst APP = Enum('RESET')\n\nconst enHanceCreateStore = compose(\n    applyMiddleware(...),\n    reduxReset({\n     type: APP.RESET,\n     data: 'initialStateComesFrom'\n    })\n  )(createStore)\nconst store = enHanceCreateStore(reducers)\n\nAFTER:\nstore.dispatch({\n  type: APP.RESET,\n  initialStateComesFrom: {app: {user: 'anotherUser'}}\n})\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwwayne%2Fredux-reset","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwwayne%2Fredux-reset","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwwayne%2Fredux-reset/lists"}