{"id":15673469,"url":"https://github.com/jwebcoder/recost-persist","last_synced_at":"2026-01-19T18:33:03.127Z","repository":{"id":33214820,"uuid":"155095182","full_name":"JWebCoder/recost-persist","owner":"JWebCoder","description":"persists application state into localstorage using recost","archived":false,"fork":false,"pushed_at":"2023-01-04T16:21:48.000Z","size":549,"stargazers_count":1,"open_issues_count":7,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-15T05:16:24.605Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/JWebCoder.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":"JWebCoder","patreon":"jwebcoder","open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2018-10-28T17:10:32.000Z","updated_at":"2021-05-17T21:33:20.000Z","dependencies_parsed_at":"2023-01-14T23:56:37.083Z","dependency_job_id":null,"html_url":"https://github.com/JWebCoder/recost-persist","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JWebCoder%2Frecost-persist","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JWebCoder%2Frecost-persist/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JWebCoder%2Frecost-persist/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JWebCoder%2Frecost-persist/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JWebCoder","download_url":"https://codeload.github.com/JWebCoder/recost-persist/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247584060,"owners_count":20962071,"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":[],"created_at":"2024-10-03T15:40:43.068Z","updated_at":"2026-01-19T18:33:03.099Z","avatar_url":"https://github.com/JWebCoder.png","language":"JavaScript","funding_links":["https://github.com/sponsors/JWebCoder","https://patreon.com/jwebcoder"],"categories":[],"sub_categories":[],"readme":"# recost-persist\nRecost middleware to persist application state into localstorage on state changes\n\n## Instalation\n\n`npm install --save recost-persist`\n\n## Usage\n\n```js\nimport React from 'react'\nimport ReactDOM from 'react-dom'\nimport App from './App'\nimport initContext, { Provider } from 'recost'\nimport { persister, reloadPersistedState } from 'recost-persist'\nimport reducer from './reducer'\n\n// define the initial state for the application\nconst initialState = {\n  // ...\n}\n\nconst STATE_KEY = 'APP_STATE'\n\n// get the stored application state\nlet state = reloadPersistedState(STATE_KEY, initialState)\n\n/*\n * inicialize the context with the obtained state\n * add the persister middleware with a STATE_KEY\n*/\ninitContext(state, reducer, [persister(STATE_KEY)])\n\n// and just render :)\nReactDOM.render(\n  \u003cProvider\u003e\n    \u003cApp/\u003e\n  \u003c/Provider\u003e,\n  document.getElementById('root')\n);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjwebcoder%2Frecost-persist","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjwebcoder%2Frecost-persist","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjwebcoder%2Frecost-persist/lists"}