-
Notifications
You must be signed in to change notification settings - Fork 46.8k
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
[RFC] Add a new React.createRef() API for ref objects #11555
Changes from 5 commits
16ad19b
622c486
e2005e2
3d95e79
e129a9f
f090ae6
ae4db19
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/** | ||
* Copyright (c) 2013-present, Facebook, Inc. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
import type {RefObject} from 'shared/ReactTypes'; | ||
|
||
// an immutable object with a single mutable value | ||
export function createRef(): RefObject { | ||
const refObject = { | ||
value: null, | ||
}; | ||
if (__DEV__) { | ||
Object.seal(refObject); | ||
} | ||
return refObject; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,3 +45,7 @@ export type ReactPortal = { | |
// TODO: figure out the API for cross-renderer implementation. | ||
implementation: any, | ||
}; | ||
|
||
export type RefObject = {| | ||
value: any, | ||
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. With input will be 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. Yep, I believe 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. Might be a bit much, but what if it was |
||
|}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing
@flow
annotation?