Skip to content

Commit 4e01c53

Browse files
committed
Fix initialState
1 parent d7c1c16 commit 4e01c53

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

src/React/Basic.purs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,6 @@ foreign import createComponent
146146
. String
147147
-> Component props
148148

149-
-- | A simplified alias for `ComponentSpec`. This type is usually used to represent
150-
-- | the default component type returned from `createComponent`.
151-
-- type Component props = forall state action. ComponentSpec props state action
152-
153149
-- | Opaque component information for internal use.
154150
-- |
155151
-- | __*Note:* Never define a component with
@@ -291,7 +287,7 @@ foreign import make
291287
:: forall spec spec_ props state action
292288
. Union spec spec_ (ComponentSpec props state action)
293289
=> Component props
294-
-> { render :: Self props state action -> JSX | spec }
290+
-> { initialState :: state, render :: Self props state action -> JSX | spec }
295291
-> props
296292
-> JSX
297293

@@ -318,7 +314,7 @@ makeStateless
318314
-> props
319315
-> JSX
320316
makeStateless component render =
321-
make component { render: \self -> render self.props }
317+
make component { initialState: unit, render: \self -> render self.props }
322318

323319
-- | Represents rendered React VDOM (the result of calling `React.createElement`
324320
-- | in JavaScript).

src/React/Basic/Components/Async.purs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ asyncWithLoader loader = make component
2828
, didMount: launch
2929
-- , didUpdate: No! Implementing `didUpdate` breaks the
3030
-- Aff/Component lifecycle relationship.
31+
-- To update the Aff over time, wrap this
32+
-- component with `keyed`.
3133
, willUnmount: cleanup
3234
}
3335
where

0 commit comments

Comments
 (0)