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
@c0m1t - Hook intro #12
Conversation
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.
نظر من اینه که هدف ما صرفا ترجمه ی سریع و بدون توجه یک صفحه نیست!
اصلا اصراری نداریم خیلی سریع کل یک صفحه رو سرهم کنیم اما کیفیتی توش نبینیم.
من پیشنهاد میکنم خودتون رو بزارین جای دانشجو و دانش آموزی که به دلیل خوب نبودن سطح زبانش مجبور شده به صفحه فارسی رجوع کنه، و در مرحله ی بعد کسی رو تصور کنید که زبانش هم خوبه اما انقدر ترجمه ی فارسی ری اکت رو با کیفیت دیده که تصمیم گرفته فارسیش رو بخونه!
پس لطفا جوری بنویسید که تمام متن موقع خوندن قابل فهم باشه و احترام به شعور خواننده باشه و در افراد انگیزه و شوق ادامه رو ایجاد کنه
با تشکر
At React Conf 2018, Sophie Alpert and Dan Abramov introduced Hooks, followed by Ryan Florence demonstrating how to refactor an application to use them. Watch the video here: | ||
<blockquote dir="rtl"> | ||
<p>نکته</p> | ||
<p>ریاکت ۱۶.۸.۰ اولین نسخه منتشر شده است که از هوکها پشتیبانی میکند. هنگام ارتقاع، فراموش نکنید همهی پکیجها شامل React DOM را آپدیت نمایید. React Native در نسخهی بعدی پایدار از هوکها پشتیبانی خواهد کرد. </p> |
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.
@c0m1t @sorousht
از املای این کلمه مطمین هستین؟
من فکر میکنم ارتقاء
درست باشد.
http://www.vajehyab.com/dehkhoda/%D8%A7%D8%B1%D8%AA%D9%82%D8%A7%D8%A1
|
||
## No Breaking Changes {#no-breaking-changes} | ||
<p dir="rtl">در کنفرانس ۲۰۱۸ react، سوفیا آلپرت(Sophie Alpert) و دن آبرامف(Dan Abramov) هوکها را معرفی کردند. بعد از آن رایان فلورنس (Ryan Florence) نشان داد که چگونه میتوان به منظور استفاده از آنها[هوکها] یک اپلیکیشن را بازنویسی(refactor) کرد. ویدیوی زیر را ببینید:</p> |
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.
|
||
## Motivation {#motivation} | ||
<ul dir="rtl"> | ||
<li><strong>کاملا اختیاری.</strong> شما میتوانید هوکها را بدون نیاز به دوباره نوشتن کدهای قبلی، در چند کامپوننت جدید امتحان کنید. ولی شما در صورت عدم تمایل، مجبور به فراگیریی یا استفاده از هوکها کنید.</li> |
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.
|
||
### Complex components become hard to understand {#complex-components-become-hard-to-understand} | ||
<p dir="rtl">ریاکت راهی برای «اضافهکردن» یک رفتار قابل استفادهی مجدد یه یک کامپوننت را فراهم نمیکند (برای مثال اتصال به یک store). اگر شما مدتی با ریاکت کار کرده باشید، ممکن است با الگوهایی مانند <a href="/docs/render-props.html">render props</a> و <a href="/docs/higher-order-components.html">higher-order components</a> آشنا باشید که سعی در حل این مسیله دارند. اما این الگوها شما را مجبور به تغییر ساختار مجدد کامپوننتتان هنگام استفاده از آنها میکنند، که این مسیله میتواند مایهی زحمت و سختتر شدن فهم کد باشد. اگر به یک اپلیکیشن ریاکت نوعی در React DevTools نگاه کنید، احتمالا با «wrapper hell»ای از کامپوننتها مواجه میشوید. کامپوننتهایی که با لایههایی از providerها، consumerها، HOCها، render props و دیگر کامپوننتهایی که به تجرید کمک میکنند، احاطه شدهاند. در حالی که ما میتوانیم <a href="https://github.com/facebook/react-devtools/pull/503">آنها را در DevTools فیلتر کنیم</a>، این [مشکل] به یک مسیلهی بنیادین اشاره دارد: ریاکت باید عناصری ابتدایی برای به اشتراک گذاری منطق دارای state فراهم کند.</p> |
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.
احتمالا با «wrapper hell»ای از کامپوننتها مواجه میشوید
@sorousht پیشنهادی برای جایگزینی این قسمت نداری؟
نظر من اینه که این نوع ترجمه اصلا کمکی به فهم خواننده نمیکنه و بدتر گیجش میکنه.
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.
خود من موقع یادگیری ریاکت از روی داکیومنتیشن، به یه سری چیزای اینطوری بر خوردم که مجبور شدم برم و از سورسهای دیگه نگاه کنم. ولی قطعا این خیلی خوبه که داکیومنتیشن طوری کامل باشه که مخاطب با خوندنش بدون نیاز به منابع خارجی بتونه کلیت همه چی رو بفهمه.
برای wrapper hell معادل فارسیای ندارم ولی اگه هدف صرف ترجمه نباشه و امکان اضافه کردن توضیحات یا عکس برای رسوندن بیشتر مفهوم امکانپذیر باشه، میشه این قسمت رو بهبود داد.
|
||
In many cases it's not possible to break these components into smaller ones because the stateful logic is all over the place. It's also difficult to test them. This is one of the reasons many people prefer to combine React with a separate state management library. However, that often introduces too much abstraction, requires you to jump between different files, and makes reusing components more difficult. | ||
<p dir="rtl">ما در این رابطه بیشتر در <a href="/docs/hooks-custom.html">هوک مخصوص خود را بسازید</a> بحث خواهیم کرد.</p> |
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.
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.
.ما در این رابطه بیشتر در فلان بخش بحث خواهیم کرد
بنظر من مشکلی نداره البته اگر پیشنهادی دارین حتما بگین
|
||
## Gradual Adoption Strategy {#gradual-adoption-strategy} | ||
<p dir="rtl">بعلاوه، ریاکت ۵ سال است که عرضه شده است، و ما میخواهیم در ۵ سال آینده مطرح باشد. همانطور که <a href="https://svelte.technology/">Svelte</a>، <a href="https://angular.io/">Angular</a>،<a href="https://glimmerjs.com/">Glimmer</a>و دیگران نشان میدهند، <a href="https://en.wikipedia.org/wiki/Ahead-of-time_compilation">کامپایل پیش از موعد</a> کامپوننتها، پتانسیل قابلیتهای زیادی را دارد. بالاخص اگر به تمپلتها مححدود نباشد. ما اخیرا با |
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.
|
||
## Frequently Asked Questions {#frequently-asked-questions} | ||
<p dir="rtl"><strong>اساسا، هوک ها در کنار کدهای نوشتهشده از قبل کار خواهند کرد، پس شما میتوانید بصورت تدریجی از آنها بهره گیرید.</strong> ما این API آزمایشی را برای این به اشتراک میگذاریم تا بتوانیم از بازخوردهای سریع افراد در جامعه که برای شکل دادن به آیندهی ریاکت مشتاق هستند بهره گیریم. — and we will iterate on Hooks in the open.</p> |
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.
and we will iterate on Hooks in the open
دلیل ترجمه نکردن این بخش چیست؟
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.
ما بصورت عمومی سعی در بهبود هوکها داریم؟
|
||
We've prepared a [Hooks FAQ page](/docs/hooks-faq.html) that answers the most common questions about Hooks. | ||
<p dir="rtl">در انتها، هیچ عجلهای برای مهاجرت به هوکها وجود ندارد. ما پیشنهاد میکنیم از هرگونه «بازنویسی بزرگ» بپرهیزید، مخصوصا برای کامپوننتهای کلاسی موجود و پیچیده. برای «تفکر مبتنی بر هوکها» مقداری نیازمند تامل است. تجربهی ما این است که بهترین کار برای شروع، تمرین و کار با هوکها در کامپوننتهای جدید و غیرحیاتی است، و حصول اطمینان از اینکه همهی افراد تیم شما با آنها ارتباط برقرار کردهاند. بعد از اینکه هوکها را امتحان کردید، لطفا <a href="https://github.com/facebook/react/issues/new">بازخوردهای خود را برای ما بفرستید</a> ، چه مثبت و چه منفی.</p> |
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.
برای «تفکر مبتنی بر هوکها» مقداری نیازمند تامل است.
ساختار این جمله غلط است!
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.
تفکر مبتنی بر هوکها نیازمند تغییر در نگرش ماست
Sync with reactjs.org @ 99e97c3
@zahrajoulaei It's been a long time since @c0m1t have opened this PR. I know it isn't well written and does not meet our standards for being published, so I'm going to retouch and improve as much as possible by tonight. |
This PR was originally made by @c0m1t. Because he/she targeted master directly, I had to close the original one, and submit this PR to
fa
branch.