-
-
Notifications
You must be signed in to change notification settings - Fork 191
Expand file tree
/
Copy pathissue66.tsx
More file actions
30 lines (24 loc) · 602 Bytes
/
issue66.tsx
File metadata and controls
30 lines (24 loc) · 602 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import * as React from 'react';
import { action, Action, createStore } from 'easy-peasy';
import { createRoot } from 'react-dom/client';
interface CartModel {
products?: string[] | null;
setProducts: Action<CartModel, string[] | null>;
}
interface Model {
cart: CartModel;
}
const model: Model = {
cart: {
products: null,
setProducts: action((state, payload) => {
state.products = payload;
}),
},
};
const store = createStore<Model>(model);
const App = () => {
return <h1>test</h1>;
};
const root = createRoot(document.getElementById('app')!);
root.render(<App />);