[{"data":1,"prerenderedAt":392},["ShallowReactive",2],{"project-19100257":3},{"id":4,"name":5,"line":6,"line_source":7,"title":8,"url":9,"domain":10,"maker":11,"posted_at":12,"year":13,"points":14,"comments":15,"rank_in_year":16,"shown_in_year":17,"top":18,"tier":19,"category":20,"subcategory":21,"format":22,"keywords":23,"reception":28,"sentiment":29,"stance_mix":30,"scored_comments":34,"aspects":35,"strip":41,"post_text":44,"what":45,"said":60,"maker_in_thread":143,"shape":145,"grid":150,"attempts":342,"same_week":354,"maker_shows":213,"maker_hidden":384,"reader_version":385,"card":386},"19100257","constate","Simple way to share state using React Hooks and Context","title","Show HN: Simple way to share state using React Hooks and Context","https:\u002F\u002Fgithub.com\u002Fdiegohaz\u002Fconstate","github.com","hazdiego",1549488935,2019,131,80,348,2195,16,"notable","languages","react state management library","library",[24,25,26,27],"react","react hooks","react context","state management","roasted",-0.345,{"positive":31,"neutral":32,"mixed":31,"critical":33},1,6,11,19,{"idea":36,"performance":37,"design":40},{"positive":31,"critical":32},{"positive":38,"critical":39},0,4,{"positive":38,"critical":31},[38,38,38,38,38,38,38,38,38,38,38,38,38,38,42,38,31,38,31,31,38,31,31,31,43,43,38,38,43,31,43,31,31,31,38,38,38,38,38,38],5,3,null,{"problem":46,"audience":44,"pricing":44,"motivation":44,"time_to_build":44,"stack":52,"openness":58,"stage":59,"team_size":59},{"value":47,"source":48,"evidence":49},"Sharing state between React components using Hooks and Context.","maker",[50],{"id":51},"post",[53],{"value":54,"source":55,"evidence":56},"React","inferred",[57],{"id":51},"open_source","unknown",{"praise":61,"objections":70,"requests":95,"questions":96,"alternatives":102},[62],{"value":63,"source":64,"evidence":65},"Nice idea and examples; memoized inputs differ from createContext","commenter",[66],{"id":67,"by":68,"text":69},"19100924","Jacqued","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,…",[71,84],{"value":72,"source":64,"evidence":73},"Context API re-renders large collections of state poorly compared to Redux",[74,78,81],{"id":75,"by":76,"text":77},"19102084","RobertKerans","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…",{"id":79,"by":76,"text":80},"19104349","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…",{"id":82,"by":76,"text":83},"19103934","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,…",{"value":85,"source":64,"evidence":86},"Too many state management libraries in the React ecosystem",[87,91],{"id":88,"by":89,"text":90},"19103822","aogaili","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.",{"id":92,"by":93,"text":94},"19103396","modarts","How many times does the React community plan on skinning the same cat?",[],[97],{"value":98,"source":64,"evidence":99},"How does this differ from createContext, and how does it avoid unnecessary rerenders?",[100,101],{"id":67,"by":68,"text":69},{"id":75,"by":76,"text":77},[103,114,125,136],{"value":104,"source":64,"evidence":105},"Redux",[106,110],{"id":107,"by":108,"text":109},"19103911","nicoburns","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.",{"id":111,"by":112,"text":113},"19104747","BilalBudhani","I guess I'm still in a minority who likes Redux.",{"value":115,"source":64,"evidence":116},"MobX",[117,121],{"id":118,"by":119,"text":120},"19104922","chrisweekly","MobX is similarly mature, easily as powerful, yet much simpler \u002F easier to reason about.",{"id":122,"by":123,"text":124},"19107845","sametmax","Mobx. It's not small, but it is easier than redux.",{"value":126,"source":64,"evidence":127},"unstated",[128,132],{"id":129,"by":130,"text":131},"19100758","rbalicki","Seems to solve a similar issue as https:\u002F\u002Fgithub.com\u002Fjamiebuilds\u002Funstated",{"id":133,"by":134,"text":135},"19105058","black-alert","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…",{"value":137,"source":64,"evidence":138},"react-atom",[139],{"id":140,"by":141,"text":142},"19102462","jsnelgro","Also check out react-atom: https:\u002F\u002Fgithub.com\u002Fderrickbeining\u002Freact-atom I stumbled across it earlier this week and it's a joy to use so far. The api is inspired by clojure atoms,…",{"comments":38,"answered":38,"key":144},[],{"commenters":146,"max_depth":147,"maker_replies":38,"first_comment_mins":148,"lifespan_hours":149},48,8,54,179,[151,153,155,157,159,162,164,167,169,172,174,176,178,179,181,182,184,186,189,190,192,195,197,200,202,205,208,210,212,214,217,221,224,227,229,231,232,235,239,242,245,246,249,252,254,257,261,264,267,270,273,276,278,280,284,287,290,293,297,299,300,303,307,309,312,315,317,319,322,324,328,332,334,337,340],[88,38,38,152,89,38],"other\u002Fneutral\u002Fnone",[154,38,38,152,123,38],"19103896",[107,38,38,156,108,38],"commenter\u002Fneutral\u002Fnone",[158,38,38,156,123,38],"19103969",[160,38,38,156,161,38],"19104572","antihero",[163,38,38,156,123,38],"19104599",[165,38,38,152,166,38],"19104712","aurbano",[168,38,38,156,123,38],"19105194",[170,38,38,156,171,38],"19105063","monkeynotes",[173,38,38,152,123,38],"19105666",[175,38,38,156,108,38],"19108068",[177,38,38,152,123,38],"19113647",[118,38,38,156,119,38],[180,38,38,156,123,38],"19105647",[133,38,38,156,134,38],[183,38,38,156,123,38],"19105640",[185,38,38,156,108,38],"19108086",[187,38,38,156,188,38],"19105763","cseelus",[122,38,38,156,123,38],[191,38,38,156,108,38],"19108100",[193,38,38,156,194,38],"19104440","bsbechtel",[196,38,38,156,123,38],"19104566",[198,38,38,152,199,38],"19104707","mosselman",[201,38,38,152,123,38],"19105605",[203,38,38,152,204,38],"19104209","slifin",[206,38,38,156,207,38],"19104469","yen223",[209,38,38,152,161,38],"19104587",[67,31,42,211,68,38],"project\u002Fpositive\u002Fidea",[140,213,38,152,141,38],2,[215,213,38,152,216,38],"19108473","bokchoi",[218,43,31,219,220,38],"19101637","project\u002Fcritical\u002Fidea","ng12",[222,43,38,156,223,38],"19101792","azangru",[225,43,38,156,226,38],"19103274","tiuPapa",[75,43,31,228,76,38],"project\u002Fcritical\u002Fperformance",[230,43,38,156,220,38],"19103133",[79,43,31,228,76,38],[233,43,43,234,226,38],"19103270","project\u002Fneutral\u002Fperformance",[236,43,38,237,238,38],"19103287","other\u002Fneutral\u002Fperformance","acemarke",[240,43,38,237,241,38],"19160536","sorahn",[243,43,31,228,244,38],"19103341","tschellenbach",[82,43,31,228,76,38],[247,43,31,219,248,38],"19102907","omeid2",[250,43,38,156,251,38],"19103484","benjaminjackman",[253,43,38,156,248,38],"19104335",[255,43,31,219,256,38],"19115205","sephoric",[258,39,43,259,260,38],"19101898","project\u002Fneutral\u002Fidea","rtpg",[262,39,43,259,263,38],"19101991","foota",[265,39,38,152,266,38],"19102333","gedy",[268,39,38,152,269,38],"19102432","crooked-v",[271,39,38,152,272,38],"19102451","dangoor",[274,39,38,152,275,38],"19103660","fastball",[277,39,38,152,119,38],"19104948",[279,39,38,152,220,38],"19103155",[281,39,43,282,283,38],"19106919","project\u002Fneutral\u002Fdesign","WorldMaker",[285,39,38,152,286,38],"19112134","miklosbertalan",[288,42,31,219,289,38],"19104317","thecatspaw",[291,42,43,282,292,38],"19104372","esamatti",[294,42,43,295,296,38],"19104417","project\u002Fmixed\u002Fidea","wawhal",[298,42,31,219,161,38],"19104577",[129,32,43,259,130,38],[301,32,31,219,302,38],"19100890","ricardobeat",[304,32,31,305,306,38],"19101028","project\u002Fcritical\u002Fdesign","rckclmbr",[111,308,38,152,112,38],7,[310,308,38,152,311,38],"19104985","HyperMassive",[313,308,38,152,314,38],"19105164","molszanski",[316,308,38,152,283,38],"19107008",[318,308,38,152,314,38],"19140161",[320,308,38,152,321,38],"19112735","totololo",[323,308,38,152,314,38],"19140219",[325,147,38,326,327,38],"19104542","other\u002Fcritical\u002Fidea","austincheney",[329,147,38,330,331,38],"19104927","commenter\u002Fcritical\u002Fnone","IceDane",[333,147,38,330,327,38],"19104994",[92,335,38,336,93,38],9,"other\u002Fcritical\u002Fnone",[338,335,38,152,339,38],"19103814","Tarks",[341,335,38,330,161,38],"19104596",[343,346,349,353],{"id":344,"t":345,"points":42,"comments":31},"16758485",1522872325,{"id":347,"t":348,"points":43,"comments":31},"16776907",1523045201,{"id":350,"t":351,"points":352,"comments":213},"16803015",1523380274,10,{"id":4,"t":12,"points":14,"comments":15},[355,360,364,369,374,379],{"id":356,"name":357,"points":358,"category":359},"19050509","Learn React",509,"learning_science",{"id":361,"name":362,"points":363,"category":20},"19051914","GuiLite",355,{"id":365,"name":366,"points":367,"category":368},"19094818","Startup with no website",288,"security_privacy",{"id":370,"name":371,"points":372,"category":373},"19070114","UltronOS",220,"infrastructure",{"id":375,"name":376,"points":377,"category":378},"19075490","Linjat",122,"games",{"id":380,"name":381,"points":382,"category":383},"19084050","AskData",111,"data",false,"v2",{"id":387,"name":5,"line":6,"ai":384,"cat":20,"year":13,"points":14,"comments":15,"rec":28,"s":388,"top":18,"kw":389,"maker":11,"domain":10,"tier":19,"attempts":39,"strip":390,"url":9,"mix":391,"praise":63,"objection":72,"sub":21},19100257,-0.34,[24,25,26,27],"0000000000000050101101113300313111000000",[31,32,31,33],1794036574617]