File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -300,20 +300,24 @@ foreign import getRefs :: forall props state access eff.
300
300
ReactThis props state ->
301
301
Eff (refs :: ReactRefs (read :: Read | access ) | eff ) Refs
302
302
303
+ -- | Ref type. You can store `Ref` types on `Refs` object (which in
304
+ -- | corresponds to `this.refs`). Use `ReactDOM.refToNode` if you want to
305
+ -- store a `DOM.Node.Types.Node`
303
306
foreign import data Ref :: Type
304
307
305
- -- | Read named ref from Refs
306
308
foreign import readRefImpl :: forall props state access eff .
307
309
ReactThis props state ->
308
310
String ->
309
311
Eff (refs :: ReactRefs (read :: Read | access ) | eff ) (Nullable Ref )
310
312
313
+ -- | Read named ref from `Refs`.
311
314
readRef :: forall props state access eff .
312
315
ReactThis props state ->
313
316
String ->
314
317
Eff (refs :: ReactRefs (read :: Read | access ) | eff ) (Maybe Ref )
315
318
readRef this name = toMaybe <$> readRefImpl this name
316
319
320
+ -- | Write a `Ref` to `Refs`
317
321
foreign import writeRef :: forall props state access eff .
318
322
ReactThis props state ->
319
323
String ->
Original file line number Diff line number Diff line change @@ -305,13 +305,13 @@ ref = unsafeMkProps "ref"
305
305
306
306
-- | You can use `writeRef` to store a reference on `Refs`.
307
307
-- | ``` purescrript
308
- -- | div [ refCb (writeRef this "inputEl ") ] [...]
308
+ -- | div [ withRef (writeRef this "inputElement ") ] [...]
309
309
-- | ```
310
- refCb
310
+ withRef
311
311
:: forall access eff
312
312
. (Ref -> Eff (refs :: ReactRefs (write :: Write | access ) | eff ) Unit )
313
313
-> Props
314
- refCb cb = unsafeMkProps " ref" (unsafePerformEff <<< cb)
314
+ withRef cb = unsafeMkProps " ref" (unsafePerformEff <<< cb)
315
315
316
316
rel :: String -> Props
317
317
rel = unsafeMkProps " rel"
You can’t perform that action at this time.
0 commit comments