@@ -73,7 +73,7 @@ import React.Basic.Events (EventFn, EventHandler, SyntheticEvent, handler)
7373-- | For example:
7474-- |
7575-- | ```purs
76- -- | component :: Component
76+ -- | component :: Component Props
7777-- | component = createComponent "Counter"
7878-- |
7979-- | type Props =
@@ -124,7 +124,7 @@ type ComponentSpec props state initialState action =
124124-- | The resulting component spec is usually given the simplified `Component` type:
125125-- |
126126-- | ```purs
127- -- | component :: Component
127+ -- | component :: Component Props
128128-- | component = createComponent "Counter"
129129-- | ```
130130-- |
@@ -133,6 +133,13 @@ type ComponentSpec props state initialState action =
133133-- | `JSX` tree is a valid update, or if it needs to be replaced entirely
134134-- | (expensive and clears component state lower in the tree).
135135-- |
136+ -- | __*Note:* A specific type for the props in `Component props` should always be chosen at this point.
137+ -- | It's technically possible to declare the component with `forall props. Component props`
138+ -- | but doing so is unsafe. Leaving the prop type open allows the use of a single `Component`
139+ -- | definition in multiple React-Basic components that may have different prop types. Because
140+ -- | component lifecycles are managed by React, it's possible for incompatible prop values to
141+ -- | be passed into a lifecycle function.__
142+ -- |
136143-- | __*Note:* A `Component` is *not* a valid React component by itself. If you would like to use
137144-- | a React-Basic component from JavaScript, use `toReactComponent`.__
138145-- |
@@ -150,7 +157,7 @@ createComponent =
150157
151158-- | A simplified alias for `ComponentSpec`. This type is usually used to represent
152159-- | the default component type returned from `createComponent`.
153- type Component = forall props state action . ComponentSpec props state Unit action
160+ type Component props = forall state action . ComponentSpec props state Unit action
154161
155162-- | Opaque component information for internal use.
156163-- |
@@ -258,7 +265,7 @@ foreign import readState :: forall props state action. Self props state action -
258265-- | This is where you will want to provide customized implementations:
259266-- |
260267-- | ```purs
261- -- | component :: Component
268+ -- | component :: Component Props
262269-- | component = createComponent "Counter"
263270-- |
264271-- | type Props =
@@ -294,7 +301,7 @@ foreign import make
294301-- | Makes stateless component definition slightly less verbose:
295302-- |
296303-- | ```purs
297- -- | component :: Component
304+ -- | component :: Component Props
298305-- | component = createComponent "Xyz"
299306-- |
300307-- | myComponent :: Props -> JSX
0 commit comments