{"id":18015554,"url":"https://github.com/ehsan-shv/redux-skeleton","last_synced_at":"2026-05-15T21:38:19.506Z","repository":{"id":134259438,"uuid":"387237829","full_name":"ehsan-shv/redux-skeleton","owner":"ehsan-shv","description":"Redux skeleton with redux toolkit","archived":false,"fork":false,"pushed_at":"2021-09-04T15:54:49.000Z","size":47,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-04T15:17:19.678Z","etag":null,"topics":["redux","redux-toolkit"],"latest_commit_sha":null,"homepage":"","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/ehsan-shv.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":"2021-07-18T17:57:26.000Z","updated_at":"2023-03-07T06:48:56.000Z","dependencies_parsed_at":null,"dependency_job_id":"94291ebd-f60d-4a41-a95d-6aedf217c187","html_url":"https://github.com/ehsan-shv/redux-skeleton","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ehsan-shv/redux-skeleton","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ehsan-shv%2Fredux-skeleton","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ehsan-shv%2Fredux-skeleton/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ehsan-shv%2Fredux-skeleton/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ehsan-shv%2Fredux-skeleton/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ehsan-shv","download_url":"https://codeload.github.com/ehsan-shv/redux-skeleton/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ehsan-shv%2Fredux-skeleton/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265477308,"owners_count":23773029,"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":["redux","redux-toolkit"],"created_at":"2024-10-30T04:14:23.786Z","updated_at":"2026-05-15T21:38:19.461Z","avatar_url":"https://github.com/ehsan-shv.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Redux skeleton with redux toolkit.\n\nMore about [redux toolkit](https://redux-toolkit.js.org/).\n\n# serve at localhost:8000\n\n    $ npm start\n\nIncludes 2 slices. (comments and post)\n\n**comments.js:**\n\n    import { createSlice } from '@reduxjs/toolkit'\n\n    let id = 0\n\n    const slice = createSlice({\n      name: 'comments',\n      initialState: {\n        items: [],\n      },\n      reducers: {\n        commentAdded: (state, action) =\u003e {\n          state.items.push({\n            description: action.payload.description,\n            id: id++,\n          })\n        },\n      },\n    })\n\n    export const { commentAdded } = slice.actions\n    export default slice.reducer\n\n**posts.js:**\n\n    import { createAsyncThunk, createSlice } from '@reduxjs/toolkit'\n\n    const ENDPOINT = 'https://conduit.productionready.io/api/articles'\n    let id = 0\n\n    export const fetchedPostFromApi = createAsyncThunk(\n      'fetchedPostFromApi',\n      async () =\u003e {\n        const response = await fetch(\n          'https://conduit.productionready.io/api/articles'\n        ).then((response) =\u003e response.json())\n        return response.articles\n      }\n    )\n\n    const slice = createSlice({\n      name: 'posts',\n      initialState: {\n        items: [],\n      },\n      reducers: {\n        //   postAdded: (state, action) =\u003e {\n        //     state.items.push({\n        //       description: action.payload.description,\n        //       id: id++,\n        //     })\n        //   },\n      },\n      extraReducers: {\n        [fetchedPostFromApi.fulfilled]: (state, action) =\u003e {\n          state.items = action.payload\n        },\n      },\n    })\n\n    // export const { postAdded } = slice.actions\n    export default slice.reducer\n\n**reducer.js:**\n\n    import { combineReducers } from 'redux'\n    import postReducers from './posts'\n    import commentReducers from './comments'\n\n    export default combineReducers({\n      posts: postReducers,\n      comments: commentReducers,\n    })\n\n**configureStore.js:**\n\n    import reducer from './reducer'\n    import { configureStore } from '@reduxjs/toolkit'\n\n    const store = configureStore({\n      reducer,\n    })\n\n    export default store\n\n**index.js:**\n\n    import configureStore from './store/configureStore'\n    import { fetchedPostFromApi, postAdded } from './store/posts'\n    import { commentAdded } from './store/comments'\n\n    const store = configureStore\n\n**dispatch and get state:**\n\n    // store.dispatch(postAdded({ description: 'Post-1' }))\n    // store.dispatch(postAdded({ description: 'Post-2' }))\n\n    store.dispatch(commentAdded({ description: 'Comment-1' }))\n    store.dispatch(commentAdded({ description: 'Comment-2' }))\n\n    console.log(store.getState())\n\n    store.dispatch(fetchedPostFromApi()).then(() =\u003e {\n      console.log(store.getState())\n    })\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fehsan-shv%2Fredux-skeleton","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fehsan-shv%2Fredux-skeleton","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fehsan-shv%2Fredux-skeleton/lists"}