constate

Languages and libraries

react state management library

SHOW HN2019

constate

Simple way to share state using React Hooks and Context

github.com

#react#react hooks#react context#state management

131points
80comments
#348of 2,195 in 2019
Top 16%of 2019 by points

How HN took it

RoastedHalf or more of the comments are critical

1 positive, 6 neutral or asking, 1 mixed, 11 critical, out of 19 comments about the project. Thread score -0.34.

Idea: 1 for, 6 againstPerformance: 0 for, 4 againstDesign: 0 for, 1 against

The thread, comment by comment

Each row is a top-level comment and its replies, in HN's order. Select a cell to open that comment on HN.

positive neutral or mixed critical about another commenter or something else the maker

What HN said

What people liked

  • Nice idea and examples; memoized inputs differ from createContext

    From 1 comment
    • Hey Diego! Nice idea and examples! Let me know if I'm wrong, but the main difference between `createContainer` and a `React.createContext` call is that you memoize inputs,…
      Jacqued on HN

Objections

  • Context API re-renders large collections of state poorly compared to Redux

    From 3 comments
    • That's great for simple stuff, but without implementing some extremely hairy bitmasking logic via the callback to createContext, if you have any kind of complex state, how do you…
      RobertKerans on HN
    • That might not be an issue at all, often redux can add unneeded complexity, but the Context API isn't a direct replacement as things stand. It's not great, performance-wise, for…
      RobertKerans on HN
    • It isn't easily fixed that way: Context's single blob of state is difficult to optimise if you try to use it in the same way as (eg) Redux. shouldComponentUpdate can sorta work,…
      RobertKerans on HN
  • Too many state management libraries in the React ecosystem

    From 2 comments
    • Well, that's nice. I guess the React community is aiming to try every permutation within potential state management solution space, I mean something have to work after all.
      aogaili on HN
    • How many times does the React community plan on skinning the same cat?
      modarts on HN

Questions

  • How does this differ from createContext, and how does it avoid unnecessary rerenders?

    From 2 comments
    • Hey Diego! Nice idea and examples! Let me know if I'm wrong, but the main difference between `createContainer` and a `React.createContext` call is that you memoize inputs,…
      Jacqued on HN
    • That's great for simple stuff, but without implementing some extremely hairy bitmasking logic via the callback to createContext, if you have any kind of complex state, how do you…
      RobertKerans on HN

Alternatives named

  • Redux

    From 2 comments
    • That, or you can continue to use redux, which has existed since 2015, is mature, and still by far the most widely used state management system for react.
      nicoburns on HN
    • I guess I'm still in a minority who likes Redux.
      BilalBudhani on HN
  • MobX

    From 2 comments
    • MobX is similarly mature, easily as powerful, yet much simpler / easier to reason about.
      chrisweekly on HN
    • Mobx. It's not small, but it is easier than redux.
      sametmax on HN
  • unstated

    From 2 comments
    • Seems to solve a similar issue as https://github.com/jamiebuilds/unstated
      rbalicki on HN
    • Redux, made for very large scale applications. Most companies shouldn't use redux at all, just as Dan Abramov said several times that you probably don't need it. For unknown…
      black-alert on HN
  • react-atom

    From 1 comment
    • Also check out react-atom: https://github.com/derrickbeining/react-atom I stumbled across it earlier this week and it's a joy to use so far. The api is inspired by clojure atoms,…
      jsnelgro on HN

Category, keywords, summaries and labels on this page were made by AI (Thread Reader v2) and not checked by hand. Each point links to the comments it came from.

Add a badge to your READMEShown on HackerShow
[![Shown on HackerShow](https://hackershow.org/badge.svg)](https://hackershow.org/show/19100257)