diff --git a/src/React/Basic.purs b/src/React/Basic.purs index aa64329..4977daa 100644 --- a/src/React/Basic.purs +++ b/src/React/Basic.purs @@ -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`. @@ -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. diff --git a/src/React/Basic/DOM.purs b/src/React/Basic/DOM.purs index ca45370..3b2d2d2 100644 --- a/src/React/Basic/DOM.purs +++ b/src/React/Basic/DOM.purs @@ -93,7 +93,7 @@ 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 @@ -101,7 +101,7 @@ findDOMNode instance_ = try do 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