zerotwo icon indicating copy to clipboard operation
zerotwo copied to clipboard

Alternative API

Open egoist opened this issue 7 years ago • 1 comments

https://github.com/jamiebuilds/unstated

<store-consumer>
	<button slot-scope={state}>{{state.count}}<button>
</store-consumer>

egoist avatar Mar 05 '18 06:03 egoist

import zerotwo, { Store, Provider } from 'zerotwo'

Vue.use(zerotwo)

class CounterStore extends Store {
	state = {
		count: 0
	}

	inc = () => {
		this.state.count++
	}
}

new Vue({
	store: CounterStore,
	template: `
	<store-consumer>
		<div slot-scope="store">
			<button @click="store.inc">{{ store.state.count }}</button>
		</div>
	</store-consumer>
	`	
})

egoist avatar Mar 13 '18 14:03 egoist