diff --git a/content/docs/forwarding-refs.md b/content/docs/forwarding-refs.md index 3318d8499..22ff28ed7 100644 --- a/content/docs/forwarding-refs.md +++ b/content/docs/forwarding-refs.md @@ -4,9 +4,9 @@ title: Forwarding Refs permalink: docs/forwarding-refs.html --- -Ref forwarding is a technique for automatically passing a [ref](/docs/refs-and-the-dom.html) through a component to one of its children. This is typically not necessary for most components in the application. However, it can be useful for some kinds of components, especially in reusable component libraries. The most common scenarios are described below. +حمل مرجع روشی برای انتقال خودکار [ref](/docs/refs-and-the-dom.html) از طریق یک جزء به یکی از فرزندانش است. این به طور معمول برای بیشتر مؤلفه های برنامه ضروری نیست. با این حال، این می تواند برای برخی از انواع مؤلفه ها، به ویژه در کتابخانه های مؤلفه قابل استفاده مجدد، مفید باشد. متداول ترین موضوع ها در زیر توضیح داده شده است. -## Forwarding refs to DOM components {#forwarding-refs-to-dom-components} +## حمل جرمع به DOM کامپوننت {#forwarding-refs-to-dom-components} Consider a `FancyButton` component that renders the native `button` DOM element: `embed:forwarding-refs/fancy-button-simple.js` @@ -21,9 +21,10 @@ In the example below, `FancyButton` uses `React.forwardRef` to obtain the `ref` `embed:forwarding-refs/fancy-button-simple-ref.js` -This way, components using `FancyButton` can get a ref to the underlying `button` DOM node and access it if necessary—just like if they used a DOM `button` directly. +به این ترتیب ، اجزای با استفاده از "FancyButton" می توانند به قسمت زیر دکمه "گره" DOM مراجعه کنند و در صورت لزوم به آن دسترسی پیدا کنند - درست مثل اینکه مستقیماً از دکمه DOM استفاده می کردند. -Here is a step-by-step explanation of what happens in the above example: + +در اینجا توضیح گام به گام آنچه در مثال بالا اتفاق می افتد آورده شده است: 1. We create a [React ref](/docs/refs-and-the-dom.html) by calling `React.createRef` and assign it to a `ref` variable. 1. We pass our `ref` down to `` by specifying it as a JSX attribute. @@ -31,13 +32,13 @@ Here is a step-by-step explanation of what happens in the above example: 1. We forward this `ref` argument down to `