{"id":24612962,"url":"https://github.com/daimdn/react-nova","last_synced_at":"2026-04-09T09:56:03.491Z","repository":{"id":272019287,"uuid":"915280655","full_name":"DaimDN/react-nova","owner":"DaimDN","description":"react-nova is a powerful light weighted state management library for React, offering a centralised store, efficient selectors, async actions, and middleware support for building large scalable applications.","archived":false,"fork":false,"pushed_at":"2025-01-19T00:15:59.000Z","size":73,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-19T00:23:35.941Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/DaimDN.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2025-01-11T12:49:29.000Z","updated_at":"2025-01-19T00:16:12.000Z","dependencies_parsed_at":"2025-01-19T00:23:36.607Z","dependency_job_id":null,"html_url":"https://github.com/DaimDN/react-nova","commit_stats":null,"previous_names":["daimdn/react-hive","daimdn/react-nova"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DaimDN%2Freact-nova","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DaimDN%2Freact-nova/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DaimDN%2Freact-nova/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DaimDN%2Freact-nova/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DaimDN","download_url":"https://codeload.github.com/DaimDN/react-nova/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244265860,"owners_count":20425801,"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":"2025-01-24T20:39:03.360Z","updated_at":"2025-12-31T00:14:56.841Z","avatar_url":"https://github.com/DaimDN.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# React Nova\n\nA lightweight, type-safe state management library for React applications, built\non top of React Context and inspired by Redux.\n\n## Features\n\n- 🎯 TypeScript-first approach\n- 🔄 Redux-like pattern with simpler boilerplate\n- 📦 Built on React Context API - no external dependencies\n- 🚀 Modular state management using partials\n- 🎨 Built-in middleware support\n- 💡 Easy to understand and use\n\n## Installation\n\n```bash\nnpm install react-nova\n# or\nyarn add react-nova\n```\n\n## Quick Start\n\n### 1. Create a Partial\n\n```typescript\n// partials/counterPartial.ts\nimport { createPartial } from \"react-nova\";\n\ninterface CounterState {\n\tcount: number;\n\tloading: boolean;\n}\n\nconst initialState: CounterState = {\n\tcount: 0,\n\tloading: false,\n};\n\nexport const counterPartial = createPartial(\"counter\", initialState, {\n\tincrement: (state) =\u003e ({\n\t\t...state,\n\t\tcount: state.count + 1,\n\t}),\n\tdecrement: (state) =\u003e ({\n\t\t...state,\n\t\tcount: state.count - 1,\n\t}),\n});\n```\n\n### 2. Create Store\n\n```typescript\n// store.ts\nimport { combinePartials } from \"react-nova\";\nimport { counterPartial } from \"./partials/counterPartial\";\n\nexport const store = combinePartials([counterPartial]);\n```\n\n### 3. Add Provider\n\n```typescript\n// App.tsx\nimport { NovaProvider } from 'react-nova';\nimport { store } from './store';\n\nfunction App() {\n  return (\n    \u003cNovaProvider store={store}\u003e\n      \u003cYourComponents /\u003e\n    \u003c/NovaProvider\u003e\n  );\n}\n```\n\n### 4. Use in Components\n\n```typescript\nimport { usePartial, useActions } from 'react-nova';\nimport { counterPartial } from '../partials/counterPartial';\n\nfunction Counter() {\n  const [state, dispatch] = usePartial\u003cCounterState\u003e('counter');\n  const { increment, decrement } = useActions(counterPartial.actions);\n\n  return (\n    \u003cdiv\u003e\n      \u003ch2\u003eCount: {state.count}\u003c/h2\u003e\n      \u003cbutton onClick={() =\u003e increment()}\u003e+\u003c/button\u003e\n      \u003cbutton onClick={() =\u003e decrement()}\u003e-\u003c/button\u003e\n    \u003c/div\u003e\n  );\n}\n```\n\n## Core Concepts\n\n### Partials\n\nSimilar to Redux slices, partials are the building blocks of your state\nmanagement. Each partial represents a slice of your state with its own actions\nand reducers.\n\n### Actions\n\nActions in React Nova are created automatically when you define your reducers in\nthe partial. They maintain type safety throughout your application.\n\n### Hooks\n\n- `usePartial`: Access state and dispatch for a specific partial\n- `useActions`: Get bound action creators\n- `useSelector`: Select specific data from state\n- `useNova`: Access entire state and dispatch\n\n## Advanced Usage\n\n### Custom Middleware\n\n```typescript\nconst logger = ({ getState }) =\u003e next =\u003e action =\u003e {\n  console.log('prev state', getState());\n  console.log('action', action);\n  const result = next(action);\n  console.log('next state', getState());\n  return result;\n};\n\n// Use in provider\n\u003cNovaProvider store={store} middleware={[logger]}\u003e\n  \u003cApp /\u003e\n\u003c/NovaProvider\u003e\n```\n\n### Async Actions\n\n```typescript\nconst fetchTodos = () =\u003e async (dispatch) =\u003e {\n\tdispatch(todoPartial.actions.setLoading(true));\n\ttry {\n\t\tconst response = await fetch(\"/api/todos\");\n\t\tconst todos = await response.json();\n\t\tdispatch(todoPartial.actions.setTodos(todos));\n\t} finally {\n\t\tdispatch(todoPartial.actions.setLoading(false));\n\t}\n};\n```\n\n### Using Selectors\n\n```typescript\nconst TodoCount = () =\u003e {\n  const incompleteTodos = useSelector(state =\u003e\n    state.todos.items.filter(todo =\u003e !todo.completed)\n  );\n\n  return \u003cdiv\u003eRemaining: {incompleteTodos.length}\u003c/div\u003e;\n};\n```\n\n## Best Practices\n\n1. **Type Everything**: Make use of TypeScript to ensure type safety across your\n   application.\n2. **Organize by Feature**: Group your partials by feature rather than by type.\n3. **Keep Partials Small**: Each partial should manage a specific piece of\n   functionality.\n4. **Use Selectors**: For complex state derivations, use selectors to improve\n   performance.\n\n## Contributing\n\nContributions are welcome! Please read our contributing guidelines before\nsubmitting PRs.\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaimdn%2Freact-nova","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdaimdn%2Freact-nova","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaimdn%2Freact-nova/lists"}