re: Simple React state management with Laco VIEW POST

TOP OF THREAD FULL DISCUSSION
re: It continues to surprise me how the React ecosystem works its way through problems like state management. This looks like a nice, understandable wa...
 

That's exactly how it works :)!

Regarding hooks - I'm testing out how you can use hooks with a store. An example of an up and coming hooks api:

import { Store } from 'laco'
import { useStore } from 'laco-react'

const CounterStore = new Store({ count: 0 })

const Counter = () => {
  const state = useStore(CounterStore)
  return <div>{state.count}</div>
}
 

Ah, cool that you can use it with Hooks too. Thanks!

code of conduct - report abuse