-
Notifications
You must be signed in to change notification settings - Fork 1
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
React Ref #63
Comments
string refstring ref无法绑定到当前的"所有者": class Child extends React.Component {
componentDidMount() {
// `test` ref is here
console.log("child", this.refs);
}
render() {
let { renderer } = this.props;
return renderer && renderer();
}
}
class Parent extends React.Component {
componentDidMount() {
// empty object
console.log("parent", this.refs);
}
render() {
return (
<Child
renderer={() => {
// ref属于调用者`Child`,而不是当前的`Parent`
return <input ref="test" placeholder="ref test" />;
}}
/>
);
}
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
React Ref的发展历程:
facebook/react#1373
The text was updated successfully, but these errors were encountered: