Skip to content
Source
Sign inSign up
TanStack/devtools
Open History to see the last commit

index.tsx

20 lines545 Bytes

1import { createRoot } from 'react-dom/client'
2import { useStore } from 'zustand'
3import Devtools from './setup'
4import { store } from './zustand-client'
5​
6function App() {
7 const { count, increment, decrement } = useStore(store)
8 return (
9 <div>
10 <h1>Zustand time-travel</h1>
11 <h2>Current count: {count}</h2>
12 <button onClick={increment}>Increment</button>
13 <button onClick={decrement}>Decrement</button>
14 <Devtools />
15 </div>
16 )
18​
19const root = createRoot(document.getElementById('root')!)
20root.render(<App />)