Giter Site home page Giter Site logo

hoox's Issues

Provider 组件中 useMemo 的含义

useMemo(() => {
  setHoox = patch => setState(prevState => Object.assign(
    {},
    prevState,
    patch instanceof Function ? patch(prevState) : patch,
  ));
  resetHoox = setState;
}, []);

你好,在阅读源码的时候有个疑惑,就是 Provider 组件的实现中,有这个使用 useMemo 的操作,这里使用 useMemo 的含义是什么呢,希望作者能解答一下。

全局状态错乱问题

有一个非常严重的问题:createHoox的返回结果(比如getHoox, useHoox, createContainer)与唯一一个组件实例绑定。

比如const Container = createContainer(Counter)
那么 Container只能用在一个地方!

举个例子,如果在topbar里渲染一次Container,在menu里渲染一次Container。那么当我们调用setHoox的时候,究竟是哪个组件实例的state被修改了?

请问,您是如何使用这个插件的?

在公众号看到这个插件,有一个疑问,想请教一下。

如果项目已经使用 typescript,那么是直接引用 src 里的文件吗?
如果项目没有使用 typescript,是引用打包之后的文件吗?

想请教一下,您这边是如何在项目中使用的。
能否做到像 react 一样,生成 *.d.ts,让没有使用 typescript 的项目也可以享用类型提示。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.