Git Product home page Git Product logo

Comments (5)

dai-shi avatar dai-shi commented on June 8, 2024 1

Published: https://www.npmjs.com/package/react-hooks-global-state/v/0.11.0

There might still be some edge cases, especially with react-hot-loader.
Feedback is welcome.

Thanks again! @vans163

from react-hooks-global-state.

dai-shi avatar dai-shi commented on June 8, 2024 1

setGlobalState was added later to the API, which I now think, in a bad manner.

Correction: It's not bad, but it has to be used carefully. The API doesn't force it and there's no good document.

from react-hooks-global-state.

dai-shi avatar dai-shi commented on June 8, 2024

Oh, good catch. Let me see...

from react-hooks-global-state.

dai-shi avatar dai-shi commented on June 8, 2024

Yeah, it's queued. Thought it shouldn't be a problem because we don't expose state like getGlobalState, ...until I saw your hack in #15.
setGlobalState was added later to the API, which I now think, in a bad manner. It's easy to break things.

Could you let me know your use case when you need to setGlobalState on startup?


And I realize a possible bug in the case of createGlobalStore. 😱

from react-hooks-global-state.

dai-shi avatar dai-shi commented on June 8, 2024

The queuing was the bad idea of mine. Fixed now.
It should work both with setGlobalState and dispatch.
The test code was also added.

About reading global state, let's continue discussion in #15.

from react-hooks-global-state.

Related Issues (20)

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.