@@ -106,8 +106,8 @@ import Type.Row (class Union)
106
106
-- | a React-Basic component from JavaScript, use `toReactComponent`.__
107
107
-- |
108
108
-- | __*See also:* `Component`, `ComponentSpec`, `make`, `makeStateless`__
109
- type ComponentSpec props state action =
110
- ( initialState :: state
109
+ type ComponentSpec props state initialState action =
110
+ ( initialState :: initialState
111
111
, update :: Self props state action -> action -> StateUpdate props state action
112
112
, render :: Self props state action -> JSX
113
113
, shouldUpdate :: Self props state action -> props -> state -> Boolean
@@ -146,10 +146,6 @@ foreign import createComponent
146
146
. String
147
147
-> Component props
148
148
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
-
153
149
-- | Opaque component information for internal use.
154
150
-- |
155
151
-- | __*Note:* Never define a component with
@@ -289,9 +285,9 @@ foreign import readState :: forall props state action. Self props state action -
289
285
-- | __*See also:* `makeStateless`, `createComponent`, `Component`, `ComponentSpec`__
290
286
foreign import make
291
287
:: forall spec spec_ props state action
292
- . Union spec spec_ (ComponentSpec props state action )
288
+ . Union spec spec_ (ComponentSpec props state state action )
293
289
=> Component props
294
- -> { render :: Self props state action -> JSX | spec }
290
+ -> { initialState :: state , render :: Self props state action -> JSX | spec }
295
291
-> props
296
292
-> JSX
297
293
@@ -318,7 +314,7 @@ makeStateless
318
314
-> props
319
315
-> JSX
320
316
makeStateless component render =
321
- make component { render: \self -> render self.props }
317
+ make component { initialState: unit, render: \self -> render self.props }
322
318
323
319
-- | Represents rendered React VDOM (the result of calling `React.createElement`
324
320
-- | in JavaScript).
@@ -430,7 +426,7 @@ data ReactComponentInstance
430
426
-- | __*See also:* `ReactComponent`__
431
427
foreign import toReactComponent
432
428
:: forall spec spec_ jsProps props state action
433
- . Union spec spec_ (ComponentSpec props state action )
429
+ . Union spec spec_ (ComponentSpec props state state action )
434
430
=> ({ | jsProps } -> props )
435
431
-> Component props
436
432
-> { render :: Self props state action -> JSX | spec }
0 commit comments