zustand 3 milestones
See original GitHub issueLet’s collect some,
- Concurrent React, are we ready for it?
- Simpler API?
currently
const [useStore, api] = create(set => ({ set, count: 0 }))
const count = useStore(state => state.count)
const count = api.getState().count
const unsub = api.subscribe(count => console.log(count), state => state.count)
api.setState({ count: 1 })
why not
const useStore = create(set => ({ set, count: 0 }))
const count = useStore(state => state.count)
const count = useStore.getState().count
const unsub = useStore.subscribe(count => console.log(count), state => state.count)
useStore.setState({ count: 1 })
vanilla users wouldn’t name it “useStore”
const api = create(set => ({ set, count: 0 }))
const count = api.getState().count
it would mean we’re now api compatible with redux without doing much.
with a little bit of hacking it could also be made backwards compatible by giving it a iterable property. i’ve done this before with three-fibers useModel which returned an array once, but then i decided a single value is leaner.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:6
- Comments:25 (11 by maintainers)
Top Results From Across the Web
Mathieu A. on Twitter: "@0xca0a @dai_shi Thanks! We use zustand ...
zustand 3 milestones · Issue #71 · pmndrs/zustand. Let's collect some, Concurrent React, are we ready for it? Simpler API? currently const [useStore, ......
Read more >Important Milestones: Your Baby By Three Years | CDC
Check the milestones your child has reached by the end of 3 years by completing a checklist with CDC's free Milestone Tracker mobile...
Read more >Gemini 60 Milestone Cards Gift/ Baby Milestones/ Twins - Etsy
Zustand. Select an option, Ohne Mängel, Mit kleinen Mängeln [Sold out, waitlist available]. Please select an option. Returns & exchanges accepted.
Read more >Customer reviews: Porsche Milestones - Amazon.com
Ein ganz tolles Buch für Porsche Liebhaber. Jedoch kam es in keinem neuwertigen Zustand an. Keine Folie um das Buch. Buchdeckel und Buchrücken...
Read more >Same---Doppel CD 50 Golden Milestones Vol.3 - Musik - Atlaz
Musiktitel:50 Golden Milestones Vol.3.Produktart:cd.Genre:Rock. der gebraucht wurde, wie z.B. Gebrauchsspuren oder Risse.sich aber in einem guten Zustand ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Looks like a new React hook might solve this: https://github.com/reactjs/rfcs/pull/147
Another idea for clean api would be to return the api object and have the hook be a property on it.