react-state-flow 0.0.1
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.
- package/README.md +41 -0
- package/dist/index.js +75989 -0
- package/dist/ui/assets/index-BZV40eAE.css +1 -0
- package/dist/ui/assets/index-CMEcbN2L.js +62 -0
- package/dist/ui/index.html +17 -0
- package/package.json +34 -0
package/README.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# react-state-flow
|
|
2
|
+
|
|
3
|
+
Visualize your React component hierarchy and state flow in real-time.
|
|
4
|
+
|
|
5
|
+
<!-- screenshot here -->
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
Run in any React project — no install required:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npx react-state-flow ./src
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
A browser window opens at `http://localhost:7272` showing an interactive graph of your components, their relationships, and context providers.
|
|
16
|
+
|
|
17
|
+
The graph updates automatically when you save files.
|
|
18
|
+
|
|
19
|
+
## Runtime instrumentation (optional)
|
|
20
|
+
|
|
21
|
+
To see which components are re-rendering and how many times, add the runtime to your app:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npm install @rsf/runtime
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
```ts
|
|
28
|
+
// main.tsx — must be the very first import
|
|
29
|
+
import '@rsf/runtime'
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Components that re-render will be highlighted in the graph in real-time.
|
|
33
|
+
|
|
34
|
+
## Requirements
|
|
35
|
+
|
|
36
|
+
- Node 18+
|
|
37
|
+
- React 17 or 18
|
|
38
|
+
|
|
39
|
+
## How it works
|
|
40
|
+
|
|
41
|
+
`react-state-flow` parses your source files statically using Babel to extract component relationships and context usage, then serves an interactive graph UI. The optional `@rsf/runtime` package hooks into React's internal fiber reconciler (the same mechanism used by React DevTools) to capture render events and stream them to the UI over WebSocket.
|