{"id":20857949,"url":"https://github.com/arman-mokhtari/quiz-reducer","last_synced_at":"2026-04-13T05:41:54.857Z","repository":{"id":255978061,"uuid":"854027005","full_name":"arman-mokhtari/quiz-reducer","owner":"arman-mokhtari","description":"A repository showcasing various practices and implementations of React's useReducer hook for managing state in functional components. Includes examples, patterns, and common use cases.","archived":false,"fork":false,"pushed_at":"2024-09-11T05:20:55.000Z","size":238,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-27T14:20:46.995Z","etag":null,"topics":["javascript","react","react-hooks","reducer-pattern","state-management","usereducer"],"latest_commit_sha":null,"homepage":"https://quiz-reducer-delta-swart.vercel.app","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/arman-mokhtari.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":"2024-09-08T07:51:27.000Z","updated_at":"2024-09-11T05:23:43.000Z","dependencies_parsed_at":null,"dependency_job_id":"d9934d83-eb84-4865-9327-c5e5d040a74c","html_url":"https://github.com/arman-mokhtari/quiz-reducer","commit_stats":null,"previous_names":["arman-mokhtari/date-counter"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/arman-mokhtari/quiz-reducer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arman-mokhtari%2Fquiz-reducer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arman-mokhtari%2Fquiz-reducer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arman-mokhtari%2Fquiz-reducer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arman-mokhtari%2Fquiz-reducer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arman-mokhtari","download_url":"https://codeload.github.com/arman-mokhtari/quiz-reducer/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arman-mokhtari%2Fquiz-reducer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31741541,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-13T05:13:27.074Z","status":"ssl_error","status_checked_at":"2026-04-13T05:13:25.150Z","response_time":93,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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","react-hooks","reducer-pattern","state-management","usereducer"],"created_at":"2024-11-18T04:44:02.340Z","updated_at":"2026-04-13T05:41:54.827Z","avatar_url":"https://github.com/arman-mokhtari.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# React `useReducer` Practices 🎯\n\nWelcome to the **React `useReducer` Practices** repository! This collection demonstrates different approaches and best practices for using the `useReducer` hook in React functional components to manage state effectively. From simple to advanced use cases, this repository will help you master the `useReducer` pattern in your projects.\n\n## 🛠️ Features\n\n- **Basic Usage**: Understand the fundamentals of `useReducer` with clear examples.\n- **Complex State Management**: Learn how to manage deeply nested state and perform multiple state updates.\n- **Action Patterns**: Implement action types, payloads, and side effects for robust state handling.\n- **Middleware Examples**: Discover how to integrate with middleware (like `useEffect`) for async actions.\n- **Custom Reducers**: Build your own custom reducers and improve your application’s scalability.\n\n## 🚀 Quick Start\n\n1. **Clone the repo**:\n\n   ```bash\n   git clone https://github.com/arman-mokhtari/quiz-reducer.git\n   cd quiz-reducer\n   ```\n\n2. **Install dependencies**:\n\n   ```bash\n   npm install\n   ```\n\n3. **Run the project**:\n\n   ```bash\n   npm start\n   ```\n\n   Navigate to `http://localhost:3000` to explore the examples.\n\n## 🏗️ Examples Overview\n\n### 1. **Basic Counter with `useReducer`**  \nA simple counter example to introduce the core concepts of `useReducer`.\n\n```js\nconst initialState = { count: 0 };\nfunction reducer(state, action) {\n  switch (action.type) {\n    case 'inc':\n      return { count: state.count + 1 };\n    case 'dec':\n      return { count: state.count - 1 };\n    default:\n      throw new Error();\n  }\n}\n```\n\n### 2. **Todo App**  \nA classic Todo app to demonstrate how to manage a list of tasks and handle complex state updates.\n\n### 3. **Fetching Data with Side Effects**  \nHow to fetch data asynchronously using `useReducer` and `useEffect`.\n\n### 4. **Managing Complex State**  \nLearn how to deal with complex state structures using nested objects and arrays.\n\n## 🧠 Concepts Covered\n\n- State and action types\n- Action payloads\n- Conditional logic in reducers\n- Side effects with `useEffect`\n- Best practices for organizing reducer logic\n\n## 📚 Learn More\n\n- [React Docs - `useReducer`](https://reactjs.org/docs/hooks-reference.html#usereducer)\n- [How to manage state with `useReducer`](https://reactjs.org/docs/hooks-faq.html#how-to-avoid-passing-callbacks-down)\n\n## 🤝 Contributing\n\nFeel free to open issues or submit pull requests! Contributions are welcome.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farman-mokhtari%2Fquiz-reducer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farman-mokhtari%2Fquiz-reducer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farman-mokhtari%2Fquiz-reducer/lists"}