Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

zustand simple counter

// store/store.js

import create from 'zustand'

export const useStore = create(set => ({
 count: 0,
 incrementCount: () => set(state => ({count: state.count + 1})),
 decrementCount: () => set(state => ({count: state.count - 1})) 
}))
Source by dev.to #
 
PREVIOUS NEXT
Tagged: #zustand #simple #counter
ADD COMMENT
Topic
Name
3+6 =