-
-
Notifications
You must be signed in to change notification settings - Fork 251
Migrate to Core #876
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
Migrate to Core #876
Changes from 5 commits
a13044c
f0b51f4
1ec5c04
c8dc2b8
6552fbc
6d659e5
8bb5c90
901c244
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,12 +5,12 @@ | |
"main": "index.js", | ||
"license": "MIT", | ||
"dependencies": { | ||
"@rescript/core": "^0.6.0", | ||
"@rescript/core": "^1.3.0", | ||
fhammerschmidt marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"@rescript/react": "^0.12.0", | ||
"rescript-1000": "npm:[email protected]", | ||
"rescript-1010": "npm:[email protected]", | ||
"rescript-1100": "npm:[email protected]", | ||
"rescript-1110": "npm:[email protected]-rc.8", | ||
"rescript-1110": "npm:[email protected]", | ||
"rescript-820": "npm:[email protected]", | ||
"rescript-902": "npm:[email protected]", | ||
"rescript-912": "npm:[email protected]" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,12 +56,12 @@ module FancyInput = { | |
|
||
@react.component | ||
let make = () => { | ||
let input = React.useRef(Js.Nullable.null) | ||
let input = React.useRef(Nullable.null) | ||
|
||
let focusInput = () => | ||
input.current | ||
->Js.Nullable.toOption | ||
->Belt.Option.forEach(input => input->focus) | ||
->Nullable.toOption | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. there is also There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done 6d659e5 |
||
->Option.forEach(input => input->focus) | ||
|
||
let onClick = _ => focusInput() | ||
|
||
|
@@ -96,7 +96,7 @@ module FancyInput = { | |
<input | ||
type_="text" | ||
?className | ||
ref=?{Js.Nullable.toOption(ref)->Belt.Option.map(ReactDOM.Ref.domRef)} | ||
ref=?{Nullable.toOption(ref)->Option.map(ReactDOM.Ref.domRef)} | ||
/> | ||
children | ||
</div> | ||
|
@@ -107,10 +107,10 @@ module FancyInput = { | |
|
||
@react.component | ||
let make = () => { | ||
let input = React.useRef(Js.Nullable.null) | ||
let input = React.useRef(Nullable.null) | ||
|
||
let focusInput = () => | ||
input.current->Js.Nullable.toOption->Belt.Option.forEach(input => input->focus) | ||
input.current->Nullable.toOption->Option.forEach(input => input->focus) | ||
|
||
let onClick = _ => focusInput() | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,12 +56,12 @@ More infos on direct DOM manipulation can be found in the [Refs and the DOM](./r | |
|
||
@react.component | ||
let make = () => { | ||
let inputEl = React.useRef(Js.Nullable.null) | ||
let inputEl = React.useRef(Nullable.null) | ||
|
||
let onClick = _ => { | ||
inputEl.current | ||
->Js.Nullable.toOption | ||
->Belt.Option.forEach(input => input->focus) | ||
->Nullable.toOption | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nullable.forEach There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done 6d659e5 |
||
->Option.forEach(input => input->focus) | ||
} | ||
|
||
<> | ||
|
@@ -104,15 +104,15 @@ Reusing the example from our [Refs and the DOM](./refs-and-the-dom#callback-refs | |
|
||
@react.component | ||
let make = () => { | ||
let textInput = React.useRef(Js.Nullable.null) | ||
let textInput = React.useRef(Nullable.null) | ||
let setTextInputRef = element => { | ||
textInput.current = element; | ||
} | ||
|
||
let focusTextInput = _ => { | ||
textInput.current | ||
->Js.Nullable.toOption | ||
->Belt.Option.forEach(input => input->focus) | ||
->Nullable.toOption | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nullable.forEach There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done 6d659e5 |
||
->Option.forEach(input => input->focus) | ||
} | ||
|
||
<div> | ||
|
Uh oh!
There was an error while loading. Please reload this page.