@inglorious/react-store 6.0.0 → 6.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +40 -17
  2. package/package.json +3 -2
  3. package/src/index.jsx +13 -13
package/README.md CHANGED
@@ -18,6 +18,7 @@ Connect your React app to Inglorious Store with a familiar API. Built on `react-
18
18
  - **Batched mode** - Updates process on a timer (performance optimization)
19
19
  - **Redux DevTools Support**: Full integration with Redux DevTools for debugging
20
20
  - **Battle-tested**: Built on `react-redux` for proven performance and stability
21
+ - **TypeScript Support**: Optional type safety for those who want it
21
22
 
22
23
  ---
23
24
 
@@ -389,30 +390,32 @@ export default function TodoApp() {
389
390
 
390
391
  ## TypeScript Support
391
392
 
392
- Full TypeScript support coming soon! For now, you can add type assertions:
393
+ Full TypeScript support is available! The library includes complete type definitions.
393
394
 
394
- ```typescript
395
- import type { RootState } from "./store"
395
+ **Quick example:**
396
396
 
397
- const value = useSelector((state: RootState) => state.myCounter.value)
398
- ```
397
+ ```typescript
398
+ // Define your types
399
+ import { BaseEntity } from "@inglorious/store"
399
400
 
400
- ---
401
+ interface CounterEntity extends BaseEntity {
402
+ type: "counter"
403
+ value: number
404
+ }
401
405
 
402
- ## Comparison to Plain react-redux
406
+ interface AppState {
407
+ myCounter: CounterEntity
408
+ [id: string]: CounterEntity
409
+ }
403
410
 
404
- **What's the same:**
411
+ // Create typed store
412
+ const store = createStore<CounterEntity, AppState>({ types, entities })
405
413
 
406
- - `<Provider>` and `useSelector` work identically
407
- - Full Redux DevTools support
408
- - Same performance characteristics
409
-
410
- **What's different:**
414
+ // Everything else works the same!
415
+ const { Provider, useSelector, useNotify } = createReactStore(store)
416
+ ```
411
417
 
412
- - Custom `useNotify` hook instead of `useDispatch`
413
- - ✅ Batched mode option for performance
414
- - ✅ Automatic `store.update()` handling
415
- - ✅ Cleaner API for event-based state management
418
+ For complete TypeScript examples, see the [@inglorious/store TypeScript documentation](https://github.com/IngloriousCoderz/inglorious-engine/tree/main/packages/store#typescript).
416
419
 
417
420
  ---
418
421
 
@@ -430,6 +433,26 @@ A: Yes! It works anywhere `react-redux` works.
430
433
  **Q: Can I use Redux middleware?**
431
434
  A: Use Inglorious Store middleware instead. See [@inglorious/store docs](https://github.com/IngloriousCoderz/inglorious-engine/tree/main/packages/store).
432
435
 
436
+ **Q: Do I need TypeScript?**
437
+ A: Not at all! The library works great with plain JavaScript. TypeScript support is completely optional.
438
+
439
+ ---
440
+
441
+ ## Comparison to Plain react-redux
442
+
443
+ **What's the same:**
444
+
445
+ - `<Provider>` and `useSelector` work identically
446
+ - Full Redux DevTools support
447
+ - Same performance characteristics
448
+
449
+ **What's different:**
450
+
451
+ - ✅ Custom `useNotify` hook instead of `useDispatch`
452
+ - ✅ Batched mode option for performance
453
+ - ✅ Automatic `store.update()` handling
454
+ - ✅ Cleaner API for event-based state management
455
+
433
456
  ---
434
457
 
435
458
  ## License
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inglorious/react-store",
3
- "version": "6.0.0",
3
+ "version": "6.0.2",
4
4
  "description": "Official React bindings for @inglorious/store. Provides hooks and a Provider to connect your React components to the store.",
5
5
  "author": "IceOnFire <antony.mistretta@gmail.com> (https://ingloriouscoderz.it)",
6
6
  "license": "MIT",
@@ -26,6 +26,7 @@
26
26
  "type": "module",
27
27
  "exports": {
28
28
  ".": {
29
+ "types": "./types/index.d.ts",
29
30
  "import": "./src/index.jsx"
30
31
  }
31
32
  },
@@ -40,7 +41,7 @@
40
41
  },
41
42
  "peerDependencies": {
42
43
  "react": "^19.2.0",
43
- "@inglorious/store": "6.1.0"
44
+ "@inglorious/store": "6.1.2"
44
45
  },
45
46
  "devDependencies": {
46
47
  "prettier": "^3.6.2",
package/src/index.jsx CHANGED
@@ -1,13 +1,13 @@
1
- import { Provider, useSelector } from "react-redux"
2
-
3
- export function createReactStore(store) {
4
- function StoreProvider({ children }) {
5
- return <Provider store={store}>{children}</Provider>
6
- }
7
-
8
- function useNotify() {
9
- return store._api.notify
10
- }
11
-
12
- return { Provider: StoreProvider, useSelector, useNotify }
13
- }
1
+ import { Provider, useSelector } from "react-redux"
2
+
3
+ export function createReactStore(store) {
4
+ function StoreProvider({ children }) {
5
+ return <Provider store={store}>{children}</Provider>
6
+ }
7
+
8
+ function useNotify() {
9
+ return store._api.notify
10
+ }
11
+
12
+ return { Provider: StoreProvider, useSelector, useNotify }
13
+ }