@everystate/react 1.0.0

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 +51 -0
  2. package/index.js +8 -0
  3. package/package.json +30 -0
package/README.md ADDED
@@ -0,0 +1,51 @@
1
+ # @everystate/react
2
+
3
+ **React adapter for EveryState with hooks**
4
+
5
+ Use EveryState in React with `usePath`, `useIntent`, and `useAsync` hooks.
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ npm install @everystate/react @everystate/core react
11
+ ```
12
+
13
+ ## Quick Start
14
+
15
+ ```jsx
16
+ import { createEventState } from '@everystate/core';
17
+ import { EventStateProvider, usePath } from '@everystate/react';
18
+
19
+ const store = createEventState({ count: 0 });
20
+
21
+ function Counter() {
22
+ const count = usePath('count');
23
+
24
+ return (
25
+ <div>
26
+ <p>Count: {count}</p>
27
+ <button onClick={() => store.set('count', count + 1)}>
28
+ Increment
29
+ </button>
30
+ </div>
31
+ );
32
+ }
33
+
34
+ function App() {
35
+ return (
36
+ <EventStateProvider store={store}>
37
+ <Counter />
38
+ </EventStateProvider>
39
+ );
40
+ }
41
+ ```
42
+
43
+ ## Hooks
44
+
45
+ - **`usePath(path)`** Subscribe to a specific path
46
+ - **`useIntent(intentName, handler)`** Handle user intents
47
+ - **`useAsync(path, fetcher)`** Async data loading
48
+
49
+ ## License
50
+
51
+ MIT © Ajdin Imsirovic
package/index.js ADDED
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @everystate/react
3
+ *
4
+ * EveryState wrapper for @uistate/react
5
+ * Re-exports all functionality from the underlying @uistate/react package
6
+ */
7
+
8
+ export * from '@uistate/react';
package/package.json ADDED
@@ -0,0 +1,30 @@
1
+ {
2
+ "name": "@everystate/react",
3
+ "version": "1.0.0",
4
+ "description": "EveryState React: React adapter with usePath, useIntent, useAsync hooks and EventStateProvider",
5
+ "type": "module",
6
+ "main": "index.js",
7
+ "keywords": [
8
+ "everystate",
9
+ "react",
10
+ "state-management",
11
+ "hooks",
12
+ "useSyncExternalStore",
13
+ "event-driven",
14
+ "dot-path",
15
+ "external-store",
16
+ "adapter"
17
+ ],
18
+ "author": {
19
+ "name": "Ajdin Imsirovic",
20
+ "url": "https://www.linkedin.com/in/ajdin-imsirovic"
21
+ },
22
+ "license": "MIT",
23
+ "repository": {
24
+ "type": "git",
25
+ "url": "https://github.com/ImsirovicAjdin/everystate-react"
26
+ },
27
+ "dependencies": {
28
+ "@uistate/react": "^1.0.1"
29
+ }
30
+ }