Skip to content
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

Move the "Using forwardRef" and "Using a getter" sections to a lower hierarchy level #3282

Merged
merged 1 commit into from
Aug 28, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/new-architecture-library-intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ We can’t convert this call to `this._ref.measure` because `this._ref` is an in

`ChildComponent` renders a `View`, which is a HostComponent, so we need to get a reference to `View` instead. There are typically two approaches to get what we need. If the component we need to get the ref from is a function component using `forwardRef` is probably the right choice. If it is a class component with other public methods, adding a public method for getting the ref is an option. Here are examples of those two forms:

### Using `forwardRef`
#### Using `forwardRef`

```jsx
class ParentComponent extends React.Component<Props> {
Expand Down Expand Up @@ -307,7 +307,7 @@ const ChildComponent = React.forwardRef((props, forwardedRef) => {
});
```

### Using a getter, (note the addition of `getViewRef`)
#### Using a getter, (note the addition of `getViewRef`)

```tsx
class ParentComponent extends React.Component<Props> {
Expand Down