From f75e4529109640e39e527cdadda66d5e748ab1bf Mon Sep 17 00:00:00 2001 From: Jamie Kyle Date: Mon, 13 May 2019 16:31:32 -0700 Subject: add initialState --- example/index.tsx | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'example') 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 ( - + -
+
- +
+ +
-
-
+ + ) } -- cgit v1.2.3