{"action":"created","comment":{"url":"https://api.github.com/repos/reactjs/fa.reactjs.org/pulls/comments/279214834","pull_request_review_id":231488734,"id":279214834,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI3OTIxNDgzNA==","diff_hunk":"@@ -157,60 +168,59 @@ useEffect(\n );\n ```\n \n-Now the subscription will only be recreated when `props.source` changes.\n-\n->Note\n+>توجه\n >\n->If you use this optimization, make sure the array includes **all values from the component scope (such as props and state) that change over time and that are used by the effect**. Otherwise, your code will reference stale values from previous renders. Learn more about [how to deal with functions](/docs/hooks-faq.html#is-it-safe-to-omit-functions-from-the-list-of-dependencies) and what to do when the [array values change too often](/docs/hooks-faq.html#what-can-i-do-if-my-effect-dependencies-change-too-often).\n+>اگر خواستید این بهینه سازی را انجام دهید، اول اطمینان حاصل کنید که **تمام متغیر‌هایی که در حوزه ی کامپوننت هستند (از قبیل state و  props‌ها) که در طول زمان عوض می‌شوند و افکت از آنها استفاده می‌کند**، در آرایه اضافه کرده اید. در غیر این صورت، کد شما از متغیرهای مرده ای که از رندر‌های پیشین به جای مانده اند استفاده خواهد کرد. یاد بگیرید که [چگونه با توابع کار کنید](/docs/hooks-faq.html#is-it-safe-to-omit-functions-from-the-list-of-dependencies) و زمانی که [آرایه متغیرها مکررا تغییر می‌کند](/docs/hooks-faq.html#what-can-i-do-if-my-effect-dependencies-change-too-often)، چه کنید.\n >\n->If you want to run an effect and clean it up only once (on mount and unmount), you can pass an empty array (`[]`) as a second argument. This tells React that your effect doesn't depend on *any* values from props or state, so it never needs to re-run. This isn't handled as a special case -- it follows directly from how the dependencies array always works.\n+>اگر شما می‌خواهید که یک افکت فقط یک بار اجرا و پاکسازی شود (در mount و unmount)، می‌توانید به عنوان آرگومان دوم یک آرایه ی خالی (`[]`) وارد کنید. با این کار به ری‌اکت می‌گویید که افکت شما هیچ وابستگی به متغیرهای state یا props ندارد. پس لازم نیست که مجددا اجرا شود. البته این یک حالت ویژه نیست – آرایه ی وابستگی‌ها همیشه اینطور کار می‌کنند. \n >\n->If you pass an empty array (`[]`), the props and state as inside the effect will always have their initial values. While passing `[]` as the second argument is closer to the familiar `componentDidMount` and `componentWillUnmount` mental model, there are usually [better](/docs/hooks-faq.html#is-it-safe-to-omit-functions-from-the-list-of-dependencies) [solutions](/docs/hooks-faq.html#what-can-i-do-if-my-effect-dependencies-change-too-often) to avoid re-running effects too often. Also, don't forget that React defers running `useEffect` until after the browser has painted, so doing extra work is less of a problem.\n+>وقتی که یک آرایه ی خالی (`[]`) به آن می‌دهید، state و props شما، در درون افکت، همیشه معادل اولین ارزشی خواهند بود که برایشان تعریف کرده بودید. دادن `[]` به عنوان آرگومان دوم یک افکت، شاید نزدیک‌ترین چیز به مدل `componentDidMount`  و `componentWillUnmount`  باشد، اما معمولا [راه‌های ](/docs/hooks-faq.html#is-it-safe-to-omit-functions-from-the-list-of-dependencies) [بهتری](/docs/hooks-faq.html#what-can-i-do-if-my-effect-dependencies-change-too-often) هست که با استفاده از آنها بتوان مانع از رندر شدن مکرر شد. از سوی دیگر فراموش نکنید که ری‌اکت اجرای useEffect  را تا زمانی که مرورگر ترسیم صفحه را تمام نکرده باشد به تعویق می‌اندازد، در نتیجه انجام این کارهای اضافی، مشکلات کمتری درست می‌کند. ","path":"content/docs/hooks-reference.md","position":208,"original_position":208,"commit_id":"bf20c4624f410de530ef172dfa6dd3d6111facb1","original_commit_id":"bf20c4624f410de530ef172dfa6dd3d6111facb1","user":{"login":"seven-deuce","id":40258654,"node_id":"MDQ6VXNlcjQwMjU4NjU0","avatar_url":"https://avatars1.githubusercontent.com/u/40258654?v=4","gravatar_id":"","url":"https://api.github.com/users/seven-deuce","html_url":"https://github.com/seven-deuce","followers_url":"https://api.github.com/users/seven-deuce/followers","following_url":"https://api.github.com/users/seven-deuce/following{/other_user}","gists_url":"https://api.github.com/users/seven-deuce/gists{/gist_id}","starred_url":"https://api.github.com/users/seven-deuce/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/seven-deuce/subscriptions","organizations_url":"https://api.github.com/users/seven-deuce/orgs","repos_url":"https://api.github.com/users/seven-deuce/repos","events_url":"https://api.github.com/users/seven-deuce/events{/privacy}","received_events_url":"https://api.github.com/users/seven-deuce/received_events","type":"User","site_admin":false},"body":"همون بحث مقدار و متغیر...","created_at":"2019-04-28T22:19:59Z","updated_at":"2019-04-28T22:19:59Z","html_url":"https://github.com/reactjs/fa.reactjs.org/pull/53#discussion_r279214834","pull_request_url":"https://api.github.com/repos/reactjs/fa.reactjs.org/pulls/53","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/reactjs/fa.reactjs.org/pulls/comments/279214834"},"html":{"href":"https://github.com/reactjs/fa.reactjs.org/pull/53#discussion_r279214834"},"pull_request":{"href":"https://api.github.com/repos/reactjs/fa.reactjs.org/pulls/53"}},"in_reply_to_id":279158117},"pull_request":{"url":"https://api.github.com/repos/reactjs/fa.reactjs.org/pulls/53","id":272510895,"node_id":"MDExOlB1bGxSZXF1ZXN0MjcyNTEwODk1","html_url":"https://github.com/reactjs/fa.reactjs.org/pull/53","diff_url":"https://github.com/reactjs/fa.reactjs.org/pull/53.diff","patch_url":"https://github.com/reactjs/fa.reactjs.org/pull/53.patch","issue_url":"https://api.github.com/repos/reactjs/fa.reactjs.org/issues/53","number":53,"state":"open","locked":false,"title":"Hooks API -revised","user":{"login":"seven-deuce","id":40258654,"node_id":"MDQ6VXNlcjQwMjU4NjU0","avatar_url":"https://avatars1.githubusercontent.com/u/40258654?v=4","gravatar_id":"","url":"https://api.github.com/users/seven-deuce","html_url":"https://github.com/seven-deuce","followers_url":"https://api.github.com/users/seven-deuce/followers","following_url":"https://api.github.com/users/seven-deuce/following{/other_user}","gists_url":"https://api.github.com/users/seven-deuce/gists{/gist_id}","starred_url":"https://api.github.com/users/seven-deuce/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/seven-deuce/subscriptions","organizations_url":"https://api.github.com/users/seven-deuce/orgs","repos_url":"https://api.github.com/users/seven-deuce/repos","events_url":"https://api.github.com/users/seven-deuce/events{/privacy}","received_events_url":"https://api.github.com/users/seven-deuce/received_events","type":"User","site_admin":false},"body":"\r\n<!--\r\n\r\nThank you for the PR! Contributors like you keep React awesome!\r\n\r\nPlease see the Contribution Guide for guidelines:\r\n\r\nhttps://github.com/reactjs/reactjs.org/blob/master/CONTRIBUTING.md\r\n\r\nIf your PR references an existing issue, please add the issue number below\r\n\r\n-->\r\n","created_at":"2019-04-22T21:28:55Z","updated_at":"2019-04-28T22:19:59Z","closed_at":null,"merged_at":null,"merge_commit_sha":"011e01c123268e12574dc06a41f57f2f1bb2c293","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/reactjs/fa.reactjs.org/pulls/53/commits","review_comments_url":"https://api.github.com/repos/reactjs/fa.reactjs.org/pulls/53/comments","review_comment_url":"https://api.github.com/repos/reactjs/fa.reactjs.org/pulls/comments{/number}","comments_url":"https://api.github.com/repos/reactjs/fa.reactjs.org/issues/53/comments","statuses_url":"https://api.github.com/repos/reactjs/fa.reactjs.org/statuses/bf20c4624f410de530ef172dfa6dd3d6111facb1","head":{"label":"seven-deuce:master","ref":"master","sha":"bf20c4624f410de530ef172dfa6dd3d6111facb1","user":{"login":"seven-deuce","id":40258654,"node_id":"MDQ6VXNlcjQwMjU4NjU0","avatar_url":"https://avatars1.githubusercontent.com/u/40258654?v=4","gravatar_id":"","url":"https://api.github.com/users/seven-deuce","html_url":"https://github.com/seven-deuce","followers_url":"https://api.github.com/users/seven-deuce/followers","following_url":"https://api.github.com/users/seven-deuce/following{/other_user}","gists_url":"https://api.github.com/users/seven-deuce/gists{/gist_id}","starred_url":"https://api.github.com/users/seven-deuce/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/seven-deuce/subscriptions","organizations_url":"https://api.github.com/users/seven-deuce/orgs","repos_url":"https://api.github.com/users/seven-deuce/repos","events_url":"https://api.github.com/users/seven-deuce/events{/privacy}","received_events_url":"https://api.github.com/users/seven-deuce/received_events","type":"User","site_admin":false},"repo":{"id":181895638,"node_id":"MDEwOlJlcG9zaXRvcnkxODE4OTU2Mzg=","name":"fa.reactjs.org","full_name":"seven-deuce/fa.reactjs.org","private":false,"owner":{"login":"seven-deuce","id":40258654,"node_id":"MDQ6VXNlcjQwMjU4NjU0","avatar_url":"https://avatars1.githubusercontent.com/u/40258654?v=4","gravatar_id":"","url":"https://api.github.com/users/seven-deuce","html_url":"https://github.com/seven-deuce","followers_url":"https://api.github.com/users/seven-deuce/followers","following_url":"https://api.github.com/users/seven-deuce/following{/other_user}","gists_url":"https://api.github.com/users/seven-deuce/gists{/gist_id}","starred_url":"https://api.github.com/users/seven-deuce/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/seven-deuce/subscriptions","organizations_url":"https://api.github.com/users/seven-deuce/orgs","repos_url":"https://api.github.com/users/seven-deuce/repos","events_url":"https://api.github.com/users/seven-deuce/events{/privacy}","received_events_url":"https://api.github.com/users/seven-deuce/received_events","type":"User","site_admin":false},"html_url":"https://github.com/seven-deuce/fa.reactjs.org","description":"(Work in progress) React documentation website in Persian","fork":true,"url":"https://api.github.com/repos/seven-deuce/fa.reactjs.org","forks_url":"https://api.github.com/repos/seven-deuce/fa.reactjs.org/forks","keys_url":"https://api.github.com/repos/seven-deuce/fa.reactjs.org/keys{/key_id}","collaborators_url":"https://api.github.com/repos/seven-deuce/fa.reactjs.org/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/seven-deuce/fa.reactjs.org/teams","hooks_url":"https://api.github.com/repos/seven-deuce/fa.reactjs.org/hooks","issue_events_url":"https://api.github.com/repos/seven-deuce/fa.reactjs.org/issues/events{/number}","events_url":"https://api.github.com/repos/seven-deuce/fa.reactjs.org/events","assignees_url":"https://api.github.com/repos/seven-deuce/fa.reactjs.org/assignees{/user}","branches_url":"https://api.github.com/repos/seven-deuce/fa.reactjs.org/branches{/branch}","tags_url":"https://api.github.com/repos/seven-deuce/fa.reactjs.org/tags","blobs_url":"https://api.github.com/repos/seven-deuce/fa.reactjs.org/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/seven-deuce/fa.reactjs.org/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/seven-deuce/fa.reactjs.org/git/refs{/sha}","trees_url":"https://api.github.com/repos/seven-deuce/fa.reactjs.org/git/trees{/sha}","statuses_url":"https://api.github.com/repos/seven-deuce/fa.reactjs.org/statuses/{sha}","languages_url":"https://api.github.com/repos/seven-deuce/fa.reactjs.org/languages","stargazers_url":"https://api.github.com/repos/seven-deuce/fa.reactjs.org/stargazers","contributors_url":"https://api.github.com/repos/seven-deuce/fa.reactjs.org/contributors","subscribers_url":"https://api.github.com/repos/seven-deuce/fa.reactjs.org/subscribers","subscription_url":"https://api.github.com/repos/seven-deuce/fa.reactjs.org/subscription","commits_url":"https://api.github.com/repos/seven-deuce/fa.reactjs.org/commits{/sha}","git_commits_url":"https://api.github.com/repos/seven-deuce/fa.reactjs.org/git/commits{/sha}","comments_url":"https://api.github.com/repos/seven-deuce/fa.reactjs.org/comments{/number}","issue_comment_url":"https://api.github.com/repos/seven-deuce/fa.reactjs.org/issues/comments{/number}","contents_url":"https://api.github.com/repos/seven-deuce/fa.reactjs.org/contents/{+path}","compare_url":"https://api.github.com/repos/seven-deuce/fa.reactjs.org/compare/{base}...{head}","merges_url":"https://api.github.com/repos/seven-deuce/fa.reactjs.org/merges","archive_url":"https://api.github.com/repos/seven-deuce/fa.reactjs.org/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/seven-deuce/fa.reactjs.org/downloads","issues_url":"https://api.github.com/repos/seven-deuce/fa.reactjs.org/issues{/number}","pulls_url":"https://api.github.com/repos/seven-deuce/fa.reactjs.org/pulls{/number}","milestones_url":"https://api.github.com/repos/seven-deuce/fa.reactjs.org/milestones{/number}","notifications_url":"https://api.github.com/repos/seven-deuce/fa.reactjs.org/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/seven-deuce/fa.reactjs.org/labels{/name}","releases_url":"https://api.github.com/repos/seven-deuce/fa.reactjs.org/releases{/id}","deployments_url":"https://api.github.com/repos/seven-deuce/fa.reactjs.org/deployments","created_at":"2019-04-17T13:18:26Z","updated_at":"2019-04-22T22:07:00Z","pushed_at":"2019-04-22T22:06:58Z","git_url":"git://github.com/seven-deuce/fa.reactjs.org.git","ssh_url":"git@github.com:seven-deuce/fa.reactjs.org.git","clone_url":"https://github.com/seven-deuce/fa.reactjs.org.git","svn_url":"https://github.com/seven-deuce/fa.reactjs.org","homepage":null,"size":71741,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":0,"license":{"key":"cc-by-4.0","name":"Creative Commons Attribution 4.0 International","spdx_id":"CC-BY-4.0","url":"https://api.github.com/licenses/cc-by-4.0","node_id":"MDc6TGljZW5zZTI1"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"reactjs:fa","ref":"fa","sha":"f971a6ec2081655f525670a478059ed3938bf702","user":{"login":"reactjs","id":6412038,"node_id":"MDEyOk9yZ2FuaXphdGlvbjY0MTIwMzg=","avatar_url":"https://avatars3.githubusercontent.com/u/6412038?v=4","gravatar_id":"","url":"https://api.github.com/users/reactjs","html_url":"https://github.com/reactjs","followers_url":"https://api.github.com/users/reactjs/followers","following_url":"https://api.github.com/users/reactjs/following{/other_user}","gists_url":"https://api.github.com/users/reactjs/gists{/gist_id}","starred_url":"https://api.github.com/users/reactjs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reactjs/subscriptions","organizations_url":"https://api.github.com/users/reactjs/orgs","repos_url":"https://api.github.com/users/reactjs/repos","events_url":"https://api.github.com/users/reactjs/events{/privacy}","received_events_url":"https://api.github.com/users/reactjs/received_events","type":"Organization","site_admin":false},"repo":{"id":169908427,"node_id":"MDEwOlJlcG9zaXRvcnkxNjk5MDg0Mjc=","name":"fa.reactjs.org","full_name":"reactjs/fa.reactjs.org","private":false,"owner":{"login":"reactjs","id":6412038,"node_id":"MDEyOk9yZ2FuaXphdGlvbjY0MTIwMzg=","avatar_url":"https://avatars3.githubusercontent.com/u/6412038?v=4","gravatar_id":"","url":"https://api.github.com/users/reactjs","html_url":"https://github.com/reactjs","followers_url":"https://api.github.com/users/reactjs/followers","following_url":"https://api.github.com/users/reactjs/following{/other_user}","gists_url":"https://api.github.com/users/reactjs/gists{/gist_id}","starred_url":"https://api.github.com/users/reactjs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reactjs/subscriptions","organizations_url":"https://api.github.com/users/reactjs/orgs","repos_url":"https://api.github.com/users/reactjs/repos","events_url":"https://api.github.com/users/reactjs/events{/privacy}","received_events_url":"https://api.github.com/users/reactjs/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/reactjs/fa.reactjs.org","description":"(Work in progress) React documentation website in Persian","fork":false,"url":"https://api.github.com/repos/reactjs/fa.reactjs.org","forks_url":"https://api.github.com/repos/reactjs/fa.reactjs.org/forks","keys_url":"https://api.github.com/repos/reactjs/fa.reactjs.org/keys{/key_id}","collaborators_url":"https://api.github.com/repos/reactjs/fa.reactjs.org/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/reactjs/fa.reactjs.org/teams","hooks_url":"https://api.github.com/repos/reactjs/fa.reactjs.org/hooks","issue_events_url":"https://api.github.com/repos/reactjs/fa.reactjs.org/issues/events{/number}","events_url":"https://api.github.com/repos/reactjs/fa.reactjs.org/events","assignees_url":"https://api.github.com/repos/reactjs/fa.reactjs.org/assignees{/user}","branches_url":"https://api.github.com/repos/reactjs/fa.reactjs.org/branches{/branch}","tags_url":"https://api.github.com/repos/reactjs/fa.reactjs.org/tags","blobs_url":"https://api.github.com/repos/reactjs/fa.reactjs.org/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/reactjs/fa.reactjs.org/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/reactjs/fa.reactjs.org/git/refs{/sha}","trees_url":"https://api.github.com/repos/reactjs/fa.reactjs.org/git/trees{/sha}","statuses_url":"https://api.github.com/repos/reactjs/fa.reactjs.org/statuses/{sha}","languages_url":"https://api.github.com/repos/reactjs/fa.reactjs.org/languages","stargazers_url":"https://api.github.com/repos/reactjs/fa.reactjs.org/stargazers","contributors_url":"https://api.github.com/repos/reactjs/fa.reactjs.org/contributors","subscribers_url":"https://api.github.com/repos/reactjs/fa.reactjs.org/subscribers","subscription_url":"https://api.github.com/repos/reactjs/fa.reactjs.org/subscription","commits_url":"https://api.github.com/repos/reactjs/fa.reactjs.org/commits{/sha}","git_commits_url":"https://api.github.com/repos/reactjs/fa.reactjs.org/git/commits{/sha}","comments_url":"https://api.github.com/repos/reactjs/fa.reactjs.org/comments{/number}","issue_comment_url":"https://api.github.com/repos/reactjs/fa.reactjs.org/issues/comments{/number}","contents_url":"https://api.github.com/repos/reactjs/fa.reactjs.org/contents/{+path}","compare_url":"https://api.github.com/repos/reactjs/fa.reactjs.org/compare/{base}...{head}","merges_url":"https://api.github.com/repos/reactjs/fa.reactjs.org/merges","archive_url":"https://api.github.com/repos/reactjs/fa.reactjs.org/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/reactjs/fa.reactjs.org/downloads","issues_url":"https://api.github.com/repos/reactjs/fa.reactjs.org/issues{/number}","pulls_url":"https://api.github.com/repos/reactjs/fa.reactjs.org/pulls{/number}","milestones_url":"https://api.github.com/repos/reactjs/fa.reactjs.org/milestones{/number}","notifications_url":"https://api.github.com/repos/reactjs/fa.reactjs.org/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/reactjs/fa.reactjs.org/labels{/name}","releases_url":"https://api.github.com/repos/reactjs/fa.reactjs.org/releases{/id}","deployments_url":"https://api.github.com/repos/reactjs/fa.reactjs.org/deployments","created_at":"2019-02-09T20:06:57Z","updated_at":"2019-04-20T14:19:58Z","pushed_at":"2019-04-27T14:40:52Z","git_url":"git://github.com/reactjs/fa.reactjs.org.git","ssh_url":"git@github.com:reactjs/fa.reactjs.org.git","clone_url":"https://github.com/reactjs/fa.reactjs.org.git","svn_url":"https://github.com/reactjs/fa.reactjs.org","homepage":null,"size":71419,"stargazers_count":50,"watchers_count":50,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":30,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":8,"license":{"key":"cc-by-4.0","name":"Creative Commons Attribution 4.0 International","spdx_id":"CC-BY-4.0","url":"https://api.github.com/licenses/cc-by-4.0","node_id":"MDc6TGljZW5zZTI1"},"forks":30,"open_issues":8,"watchers":50,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/reactjs/fa.reactjs.org/pulls/53"},"html":{"href":"https://github.com/reactjs/fa.reactjs.org/pull/53"},"issue":{"href":"https://api.github.com/repos/reactjs/fa.reactjs.org/issues/53"},"comments":{"href":"https://api.github.com/repos/reactjs/fa.reactjs.org/issues/53/comments"},"review_comments":{"href":"https://api.github.com/repos/reactjs/fa.reactjs.org/pulls/53/comments"},"review_comment":{"href":"https://api.github.com/repos/reactjs/fa.reactjs.org/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/reactjs/fa.reactjs.org/pulls/53/commits"},"statuses":{"href":"https://api.github.com/repos/reactjs/fa.reactjs.org/statuses/bf20c4624f410de530ef172dfa6dd3d6111facb1"}},"author_association":"NONE"}}
{"actor":{"display_login":"seven-deuce"}}