Sign in

田强 / qx-designer-dataflow · Files

GitLab

  • Go to dashboard
  • Project
  • Activity
  • Files
  • Commits
  • Builds 0
  • Graphs
  • Milestones
  • Issues 0
  • Merge Requests 0
  • Labels
  • Wiki
  • Network
  • qx-designer-dataflow
  • src
  • store
  • global
  • index.ts
  • init
    671dee50
    qiang.tian authored
    2023-08-26 15:42:17 +0800  
    Browse Files »
index.ts 360 Bytes
Raw Blame History Permalink
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
import { useState } from 'react';
import { createStore } from 'hox';

export const [useGlobalStore, GlobalStoreProvider] = createStore(() => {
  const [count, setCount] = useState(0);

  const increase = () => {
    setCount(count + 1);
  };

  const decrease = () => {
    setCount(count - 1);
  };

  return {
    count,
    increase,
    decrease,
  };
});