Eric Bower
·
2025-06-06
index.jsx
1import React from "react";
2import ReactDOM from "react-dom/client";
3import { createStore, take } from "starfx";
4import { Provider } from "starfx/react";
5import { api, initialState, schema } from "./api.js";
6import { App } from "./app.jsx";
7
8init();
9
10function init() {
11 const store = createStore({ initialState });
12 window.fx = store;
13
14 store.run([
15 function* logger() {
16 while (true) {
17 const action = yield* take("*");
18 console.log("action", action);
19 }
20 },
21 api.register,
22 ]);
23
24 ReactDOM.createRoot(document.getElementById("root")).render(
25 <React.StrictMode>
26 <Provider schema={schema} store={store}>
27 <App id="1" />
28 </Provider>
29 </React.StrictMode>,
30 );
31}