Alt. Description
import { proxy, useProxy } from 'valtio'
const state = proxy({ count: 0, text: 'hello' })
setInterval(() => {
++state.count
}, 1000)
function Counter() {
const snapshot = useProxy(state)
return (
<div>
{snapshot.count}
<button onClick={() => ++state.count}>+1</button>
</div>
)
}
And that's it!