aboutsummaryrefslogtreecommitdiff
path: root/example/index.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'example/index.tsx')
-rw-r--r--example/index.tsx16
1 files changed, 9 insertions, 7 deletions
diff --git a/example/index.tsx b/example/index.tsx
index c967d9d..89c325d 100644
--- a/example/index.tsx
+++ b/example/index.tsx
@@ -1,9 +1,9 @@
import React, { useState } from "react"
-import { Provider, createContainer } from "../src/unstated"
+import { createContainer } from "../src/unstated-next"
import { render } from "react-dom"
function useCounter() {
- let [count, setCount] = useState(0)
+ let [count, setCount] = useState(initialState)
let decrement = () => setCount(count - 1)
let increment = () => setCount(count + 1)
return { count, decrement, increment }
@@ -24,14 +24,16 @@ function CounterDisplay() {
function App() {
return (
- <Provider>
+ <Counter.Provider>
<CounterDisplay />
- <div>
+ <Counter.Provider>
<div>
- <CounterDisplay />
+ <div>
+ <CounterDisplay />
+ </div>
</div>
- </div>
- </Provider>
+ </Counter.Provider>
+ </Counter.Provider>
)
}