Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Document createRef and forwardRef usage#115

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
adrienharnay wants to merge1 commit intopiotrwitek:master
base:master
Choose a base branch
Loading
fromadrienharnay:patch-1

Conversation

adrienharnay
Copy link

Fixes#72

@piotrwitek
Copy link
Owner

Hey@adrienharnay.
Thanks for your contribution. Could you please check the contributing.md guide.

One note, this PR doesn't fix#72 entirely, it would be great to include some React component example. Examples from react docs are preferred:https://reactjs.org/docs/forwarding-refs.html

constFancyButton=React.forwardRef((props,ref)=>(<buttonref={ref}className="FancyButton">{props.children}</button>));// You can now get a ref directly to the DOM button:constref=React.createRef();<FancyButtonref={ref}>Click me!</FancyButton>;

The best place to put it would be in thestateless components section:

@piotrwitekpiotrwitekforce-pushed themaster branch 2 times, most recently from9bfd6f2 toac58144CompareFebruary 3, 2019 17:10
@artyomtrityak
Copy link

artyomtrityak commentedMar 23, 2019
edited
Loading

That is not super clear how to useforwardRef with 16.8 react.
I am usingconst Component = (props: IProps, ref?: React.Ref<HTMLDivElement>) => {...} .

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

How to use forwardRef?
3 participants
@adrienharnay@piotrwitek@artyomtrityak

[8]ページ先頭

©2009-2025 Movatter.jp