{"id":15755704,"url":"https://github.com/arman226/basic-implementation-redux-toolkit","last_synced_at":"2026-04-19T14:01:54.860Z","repository":{"id":230694594,"uuid":"488245367","full_name":"arman226/basic-implementation-redux-toolkit","owner":"arman226","description":"Basic Implementation of Redux Toolkit as State Management Tool for API Calls and Data Caching","archived":false,"fork":false,"pushed_at":"2022-05-03T16:21:26.000Z","size":183,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-06T12:33:53.002Z","etag":null,"topics":["axios","custom-hooks","flow","react-redux","reactjs","redux","redux-toolkit","thunk-middleware"],"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/arman226.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}},"created_at":"2022-05-03T14:35:23.000Z","updated_at":"2022-05-03T16:09:49.000Z","dependencies_parsed_at":"2024-03-31T10:21:10.720Z","dependency_job_id":"e06be17e-90c1-4a05-b0b3-afaaa00cc821","html_url":"https://github.com/arman226/basic-implementation-redux-toolkit","commit_stats":null,"previous_names":["arman226/basic-implementation-redux-toolkit"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arman226%2Fbasic-implementation-redux-toolkit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arman226%2Fbasic-implementation-redux-toolkit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arman226%2Fbasic-implementation-redux-toolkit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arman226%2Fbasic-implementation-redux-toolkit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arman226","download_url":"https://codeload.github.com/arman226/basic-implementation-redux-toolkit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246436372,"owners_count":20776995,"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":["axios","custom-hooks","flow","react-redux","reactjs","redux","redux-toolkit","thunk-middleware"],"created_at":"2024-10-04T08:40:23.226Z","updated_at":"2026-04-19T14:01:54.827Z","avatar_url":"https://github.com/arman226.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SET THINGS UP\n\n## INITIAL PROJECT SETUP\n\n1. Create a React Project: `npx create-react-app redux-toolkit-sample`\n2. Inside the root folder, create a new file and call it `jsconfig.json` and write the following code for absolute imports inside the src folder:\n\n```json\n{\n  \"compilerOptions\": {\n    \"baseUrl\": \"src\"\n  },\n  \"include\": [\"src\"]\n}\n```\n\n3. Install Redux Toolkit with the regular React-redux library: `npm install @reduxjs/toolkit react-redux`\n4. Install Axios for Network Calls: `npm install axios`\n5. Create the following folders under /src\n\n```\n   \u003e components\n   \u003e data\n     \u003e configs\n     \u003e services\n   \u003e ducks\n   \u003e hooks\n   \u003e pages\n```\n\n6. Under `data/` folder, create a file and call it `constants.js`. Inside this file, write the following code :\n\n```js\nexport const REQUEST_TIMEOUT_SECONDS: number = 30;\n\nexport const JSON_PLACEHOLDER_ENDPOINTS: Object = {\n  LIST_OF_TODOS: \"/todos\",\n};\n```\n\n7. Create a new file inside `data/configs` folder and call it `jsonPlaceholder.js` and inside this file, write the code below:\n\n```js\nimport axios from \"axios\";\nimport { REQUEST_TIMEOUT_SECONDS } from \"data/constants\";\n\nexport default axios.create({\n  baseURL: process.env.REACT_APP_JSON_PLACEHOLDER,\n  timeout: REQUEST_TIMEOUT_SECONDS * 1000,\n});\n```\n\n8. Create a file, under the root folder, that will contain all the environment constants/variables and call it `.env`.\n\n```env\nREACT_APP_JSON_PLACEHOLDER=https://jsonplaceholder.typicode.com/\n```\n\n9. Create a service that will get a list of todos using the axios instance that we created inside `data/configs` folder. Inside the `services` folder, create a file and name it as `listOfTodos.js` and write the code below:\n\n```js\nimport { AxiosResponse } from \"axios\";\nimport jsonPlaceholder from \"data/configs/jsonPlaceholder\";\nimport { JSON_PLACEHOLDER_ENDPOINTS } from \"data/constants\";\n\nexport default {\n  getListOfTodos: (): AxiosResponse =\u003e\n    jsonPlaceholder.get(JSON_PLACEHOLDER_ENDPOINTS.LIST_OF_TODOS),\n};\n```\n\n## REDUX-TOOLKIT CONFIGURATION\n\n10. Under the `ducks` folder, create a file and name it as `store.js` to configure our redux store, and, initially, write the code below:\n\n```js\nimport { configureStore } from \"@reduxjs/toolkit\";\n\nexport default configureStore({\n  reducer: {},\n});\n```\n\n11. Let's modify our `index.js` file so we can wrap our application using the `Provider` Component from `react-redux`. This is how it should look like:\n\n```js\nimport React from \"react\";\nimport ReactDOM from \"react-dom/client\";\nimport { Provider } from \"react-redux\";\nimport \"./index.css\";\nimport App from \"./App\";\nimport reportWebVitals from \"./reportWebVitals\";\nimport store from \"./ducks/store\";\n\nconst root = ReactDOM.createRoot(document.getElementById(\"root\"));\nroot.render(\n  \u003cReact.StrictMode\u003e\n    \u003cProvider store={store}\u003e\n      \u003cApp /\u003e\n    \u003c/Provider\u003e\n  \u003c/React.StrictMode\u003e\n);\n\nreportWebVitals();\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farman226%2Fbasic-implementation-redux-toolkit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farman226%2Fbasic-implementation-redux-toolkit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farman226%2Fbasic-implementation-redux-toolkit/lists"}