Skip to content

Commit 78893fb

Browse files
ozanmakesmununki
authored andcommitted
Update React_V3.ref to define record fields
With this change we can refer to `.current` field of the record by opening the module. Previously the following code would fail to compile with " The record field React.current can't be found." ``` open ReactV3 @get external videoWidth: Dom.Element.t => float = "videoWidth" @get external videoHeight: Dom.Element.t => float = "videoHeight" let getVideoDimensions = videoRef => videoRef.React.current ->Js.Nullable.toOption ->Option.map(video => (video->videoWidth, video->videoHeight)) ```
1 parent 86b7f85 commit 78893fb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/v3/React_V3.res

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ external jsxs: (component<'props>, 'props) => element = "jsxs"
3838
@module("react") @deprecated("Please use JSX syntax directly.")
3939
external jsxsKeyed: (component<'props>, 'props, string) => element = "jsxs"
4040

41-
type ref<'value> = React.ref<'value>
41+
type ref<'value> = React.ref<'value> = {mutable current: 'value}
4242

4343
module Ref = {
4444
@deprecated("Please use the type React.ref instead")

0 commit comments

Comments
 (0)