V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
thefack
V2EX  ›  问与答

对 React use-between 的例子有个疑问,望解答

  •  
  •   thefack · 2022-04-16 21:10:31 +08:00 · 359 次点击
    这是一个创建于 1172 天前的主题,其中的信息可能已经有所发展或是发生改变。

    https://github.com/betula/use-between

    给的例子中,为什么要用useSharedCounter多包装一次useCounter

    const useSharedCounter = () => useBetween(useCounter);

    我试了下,将上面一句省掉,直接用 const { count } = useBetween(useCounter);也能使用啊。

    有什么特殊场合需要那样吗?

    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1198 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 17:49 · PVG 01:49 · LAX 10:49 · JFK 13:49
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.