From aea4f3b654ad528443e39762cd772c030323644a Mon Sep 17 00:00:00 2001 From: Ryan Trinkle Date: Tue, 4 Jul 2023 13:01:18 -0400 Subject: [PATCH] Cleanups --- src/React/Hook.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/React/Hook.hs b/src/React/Hook.hs index 8a5794d..be71597 100644 --- a/src/React/Hook.hs +++ b/src/React/Hook.hs @@ -5,7 +5,6 @@ import Prelude hiding ((!!)) import Control.Monad import Control.Monad.Except import Control.Monad.Reader -import Data.Text (Text) import Language.Javascript.JSaddle hiding (Ref) import React.JSaddle @@ -14,6 +13,7 @@ import React.Types --TODO: Input can be an initializer function rather than value --TODO: `set` can take `a -> a` instead of `a` +--TODO: I bet React always returns the same function object for the setter; if we re-wrap the function using `useCallback` each time, we are probably hurting performance by making it be a new object each time and forcing rerendering of children useState :: (ToJSVal a, FromJSVal a) => a -> Hook (a, a -> JSM ()) useState initialValue = Hook $ do react <- ask