“penghitung sederhana Zustand” Kode Jawaban

penghitung sederhana Zustand

// 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})) 
}))
Puzzled Puffin

penghitung sederhana Zustand

// store/store.ts

import create from 'zustand'

interface Counter {
	count: number;
    incrementCount: () => void;
    decrementCount: () => void;
}

export const useStore = create<Counter>(set => ({
 count: 0,
 incrementCount: () => set(state => ({count: state.count + 1})),
 decrementCount: () => set(state => ({count: state.count - 1})) 
}))
Puzzled Puffin

Jawaban yang mirip dengan “penghitung sederhana Zustand”

Pertanyaan yang mirip dengan “penghitung sederhana Zustand”

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya