14 lines
330 B
TypeScript
14 lines
330 B
TypeScript
|
import { create } from "zustand";
|
||
|
import { devtools } from "zustand/middleware";
|
||
|
|
||
|
type Wallet = { cash: number }
|
||
|
export const useWallet = create<Wallet>()(
|
||
|
devtools(() => (
|
||
|
{ cash: 0 }
|
||
|
))
|
||
|
);
|
||
|
|
||
|
export const setCash = (cash: number) => {
|
||
|
console.log("я получил ", cash)
|
||
|
useWallet.setState({ cash })
|
||
|
};
|