Skip to content

Fix Self's action type #74

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/React/Basic.purs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ data StateUpdate props state action
type Self props state action =
{ props :: props
, state :: state
, instance_ :: ReactComponentInstance
, instance_ :: ReactComponentInstance props state action
}

-- | Dispatch an `action` into the component to be handled by `update`.
Expand Down Expand Up @@ -408,12 +408,12 @@ foreign import displayNameFromSelf
-- | ```
-- |
-- | __*See also:* `element`, `toReactComponent`__
data ReactComponent props
foreign import data ReactComponent :: Type -> Type

-- | An opaque representation of a React component's instance (`this` in the JavaScript
-- | React paradigm). It exists as an escape hatch to unsafe behavior. Use it with
-- | caution.
data ReactComponentInstance
foreign import data ReactComponentInstance :: Type -> Type -> Type -> Type

-- | Convert a React-Basic `ComponentSpec` to a JavaScript-friendly React component.
-- | This function should only be used for JS interop and not normal React-Basic usage.
Expand Down
4 changes: 2 additions & 2 deletions src/React/Basic/DOM.purs
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,15 @@ foreign import unmountComponentAtNode_ :: EffectFn1 Element Boolean
-- | `React.Basic.DOM.Components.Ref` where possible__
-- |
-- | __*Note:* Relies on `ReactDOM.findDOMNode`__
findDOMNode :: ReactComponentInstance -> Effect (Either Error Node)
findDOMNode :: forall props state action. ReactComponentInstance props state action -> Effect (Either Error Node)
findDOMNode instance_ = try do
node <- runEffectFn1 findDOMNode_ instance_
case toMaybe node of
Nothing -> throw "Node not found."
Just n -> pure n

-- | Warning: Relies on `ReactDOM.findDOMNode` which may throw exceptions
foreign import findDOMNode_ :: EffectFn1 ReactComponentInstance (Nullable Node)
foreign import findDOMNode_ :: forall props state action. EffectFn1 (ReactComponentInstance props state action) (Nullable Node)

-- | Divert a render tree into a separate DOM node. The node's
-- | content will be overwritten and managed by React, similar
Expand Down