Skip to content

Commit 32623c0

Browse files
refactor: update section headings in README
1 parent 2768c94 commit 32623c0

File tree

1 file changed

+13
-27
lines changed

1 file changed

+13
-27
lines changed

README.md

Lines changed: 13 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Tiny, ergonomic, convention‑over‑configuration state, async function, and re
2323
* Predictable: key + scope ⇒ value. That’s it.
2424

2525

26-
## 🚀 Install
26+
## Install
2727

2828
```sh
2929
npm install react-shared-states
@@ -33,7 +33,7 @@ or
3333
pnpm add react-shared-states
3434
```
3535

36-
## 60‑Second TL;DR
36+
## 60‑Second TL;DR
3737
```tsx
3838
import { useSharedState } from 'react-shared-states';
3939

@@ -196,7 +196,7 @@ export default function App(){
196196
```
197197

198198

199-
## 🧠 Core Concepts
199+
## Core Concepts
200200
| Concept | Summary |
201201
|------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------|
202202
| Global by default | No provider necessary. Same key => shared state. |
@@ -294,7 +294,7 @@ const theme = useSharedStateSelector<{ theme: string; /*...other props*/ }, 'set
294294
const theme = useSharedStateSelector(settingsState, (settings) => settings.theme);
295295
```
296296

297-
## Shared Async Functions (`useSharedFunction`)
297+
## Shared Async Functions (`useSharedFunction`)
298298
Signature:
299299
- `const { state, trigger, forceTrigger, clear } = useSharedFunction(key, asyncFn, scopeName?)`
300300
- `const { state, trigger, forceTrigger, clear } = useSharedFunction(sharedFunctionCreated)`
@@ -325,7 +325,7 @@ const refresh = () => forceTrigger();
325325
```
326326

327327

328-
## 📡 Real-time Subscriptions (`useSharedSubscription`)
328+
## Real-time Subscriptions (`useSharedSubscription`)
329329
Perfect for Firebase listeners, WebSocket connections,
330330
Server-Sent Events, or any streaming data source that needs cleanup.
331331

@@ -467,8 +467,8 @@ Subscription semantics:
467467
* Components mounting later instantly get the latest `data` without re-subscribing.
468468

469469

470-
## 🛰️ Static APIs (outside React)
471-
## 🏛️ Static/Global Shared Resource Creation
470+
## Static APIs (outside React)
471+
## Static/Global Shared Resource Creation
472472

473473
For large apps, you can create and export shared state, function,
474474
or subscription objects for type safety and to avoid key collisions.
@@ -528,7 +528,7 @@ const subStateScoped = sharedSubscriptionsApi.get('live-chat', 'myScope');
528528
`scopeName` defaults to `"_global"`. Internally, keys are stored as `${scope}//${key}`. The `.getAll()` method returns a nested object: `{ [scope]: { [key]: value } }`.
529529

530530

531-
## 🧩 Scoping Rules Deep Dive
531+
## Scoping Rules Deep Dive
532532
Resolution order used inside hooks:
533533
1. Explicit 3rd parameter (`scopeName`)
534534
2. Nearest `SharedStatesProvider` above the component
@@ -539,7 +539,7 @@ Unnamed providers auto‑generate a random scope name: each mount = isolated isl
539539
Two providers sharing the same `scopeName` act as a single logical scope even if they are disjoint in the tree (great for portals / microfrontends).
540540

541541

542-
## 🆚 Comparison Snapshot
542+
## Comparison Snapshot
543543
| Criterion | react-shared-states | Redux Toolkit | Zustand |
544544
|----------------|------------------------------------------|----------------------|----------------------------------|
545545
| Setup | Install & call hook | Slice + store config | Create store function |
@@ -551,7 +551,7 @@ Two providers sharing the same `scopeName` act as a single logical scope even if
551551
| Learning curve | Minutes | Higher | Low |
552552

553553

554-
## 🧪 Testing Tips
554+
## Testing Tips
555555
* Use static APIs to assert state after component interactions.
556556
* `sharedStatesApi.clearAll(false, true)`, `sharedFunctionsApi.clearAll(false, true)`, `sharedSubscriptionsApi.clearAll(false, true)` in `afterEach` to isolate tests and clear static states.
557557
* For async functions: trigger once, await UI stabilization, assert `results` present.
@@ -578,7 +578,7 @@ Subscriptions auto-cleanup when no components are listening. You can also manual
578578
Currently no built-in Suspense wrappers; wrap `useSharedFunction` yourself if desired.
579579

580580

581-
## 📚 Full API Reference
581+
## Full API Reference
582582
### `useSharedState(key, initialValue, scopeName?)`
583583
Returns `[value, setValue]`.
584584

@@ -611,7 +611,7 @@ Wrap children; optional `scopeName` (string). If omitted a random unique one is
611611

612612

613613

614-
## 🤝 Contributions
614+
## Contributions
615615

616616
We welcome contributions!
617617
If you'd like to improve `react-shared-states`,
@@ -631,18 +631,4 @@ feel free to [open an issue](https://github.com/HichemTab-tech/react-shared-stat
631631
Inspired by React's built-in primitives and the ergonomics of modern lightweight state libraries.
632632
Thanks to early adopters for feedback.
633633
If you'd like to improve `react-shared-states`,
634-
feel free to [open an issue](https://github.com/HichemTab-tech/react-shared-states/issues) or [submit a pull request](https://github.com/HichemTab-tech/react-shared-states/pulls).
635-
636-
637-
## Author
638-
639-
- [@HichemTab-tech](https://www.github.com/HichemTab-tech)
640-
641-
## License
642-
643-
[MIT](https://github.com/HichemTab-tech/react-shared-states/blob/master/LICENSE)
644-
645-
## 🌟 Acknowledgements
646-
647-
Inspired by React's built-in primitives and the ergonomics of modern lightweight state libraries.
648-
Thanks to early adopters for feedback.
634+
feel free to [open an issue](https://github.com/HichemTab-tech/react-shared-states/issues) or [submit a pull request](https://github.com/HichemTab-tech/react-shared-states/pulls).

0 commit comments

Comments
 (0)