{"action":"created","comment":{"url":"https://api.github.com/repos/deliveroo/deliveroo.engineering/pulls/comments/75091835","id":75091835,"diff_hunk":"@@ -3,5 +3,61 @@ title:      \"React\"\n ---\n \n \n-Empty for now\n+# Deliveroo React/JSX Style Guide\n \n+*A mostly reasonable approach to React and JSX*\n+\n+## Table of Contents\n+1. Props\n+\n+## Props\n+\n+  - Always use camelCase for prop names.\n+\n+    ```jsx\n+    // bad\n+    <Foo\n+      UserName=\"hello\"\n+      phone_number={12345678}\n+    />\n+\n+    // good\n+    <Foo\n+      userName=\"hello\"\n+      phoneNumber={12345678}\n+    />\n+    ```\n+\n+  - Omit the value of the prop when it is explicitly `true`. eslint: [`react/jsx-boolean-value`](https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-boolean-value.md)\n+\n+    ```jsx\n+    // bad\n+    <Foo\n+      hidden={true}\n+    />\n+\n+    // good\n+    <Foo\n+      hidden\n+    />\n+    ```\n+\n+  - Avoid using an array index as `key` prop, prefer a unique ID. ([why?](https://medium.com/@robinpokorny/index-as-a-key-is-an-anti-pattern-e0349aece318))\n+\n+  ```jsx\n+  // bad\n+  {todos.map((todo, index) =>\n+    <Todo\n+      {...todo}\n+      key={index}\n+    />\n+  )}\n+\n+  // good\n+  {todos.map(todo => (\n+    <Todo\n+      {...todo}\n+      key={todo.id}","path":"_guidelines/react.md","position":59,"original_position":59,"commit_id":"02a3ad66154972db6e43f21514424ce698d57f14","original_commit_id":"02a3ad66154972db6e43f21514424ce698d57f14","user":{"login":"danielcooper","id":22127,"avatar_url":"https://avatars.githubusercontent.com/u/22127?v=3","gravatar_id":"","url":"https://api.github.com/users/danielcooper","html_url":"https://github.com/danielcooper","followers_url":"https://api.github.com/users/danielcooper/followers","following_url":"https://api.github.com/users/danielcooper/following{/other_user}","gists_url":"https://api.github.com/users/danielcooper/gists{/gist_id}","starred_url":"https://api.github.com/users/danielcooper/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danielcooper/subscriptions","organizations_url":"https://api.github.com/users/danielcooper/orgs","repos_url":"https://api.github.com/users/danielcooper/repos","events_url":"https://api.github.com/users/danielcooper/events{/privacy}","received_events_url":"https://api.github.com/users/danielcooper/received_events","type":"User","site_admin":false},"body":"Will this come with a linter rule?","created_at":"2016-08-17T09:38:17Z","updated_at":"2016-08-17T09:38:17Z","html_url":"https://github.com/deliveroo/deliveroo.engineering/pull/15#discussion_r75091835","pull_request_url":"https://api.github.com/repos/deliveroo/deliveroo.engineering/pulls/15","_links":{"self":{"href":"https://api.github.com/repos/deliveroo/deliveroo.engineering/pulls/comments/75091835"},"html":{"href":"https://github.com/deliveroo/deliveroo.engineering/pull/15#discussion_r75091835"},"pull_request":{"href":"https://api.github.com/repos/deliveroo/deliveroo.engineering/pulls/15"}}},"pull_request":{"url":"https://api.github.com/repos/deliveroo/deliveroo.engineering/pulls/15","id":80774042,"html_url":"https://github.com/deliveroo/deliveroo.engineering/pull/15","diff_url":"https://github.com/deliveroo/deliveroo.engineering/pull/15.diff","patch_url":"https://github.com/deliveroo/deliveroo.engineering/pull/15.patch","issue_url":"https://api.github.com/repos/deliveroo/deliveroo.engineering/issues/15","number":15,"state":"open","locked":false,"title":"Added a prop spec to the react props md","user":{"login":"lededje","id":1545098,"avatar_url":"https://avatars.githubusercontent.com/u/1545098?v=3","gravatar_id":"","url":"https://api.github.com/users/lededje","html_url":"https://github.com/lededje","followers_url":"https://api.github.com/users/lededje/followers","following_url":"https://api.github.com/users/lededje/following{/other_user}","gists_url":"https://api.github.com/users/lededje/gists{/gist_id}","starred_url":"https://api.github.com/users/lededje/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lededje/subscriptions","organizations_url":"https://api.github.com/users/lededje/orgs","repos_url":"https://api.github.com/users/lededje/repos","events_url":"https://api.github.com/users/lededje/events{/privacy}","received_events_url":"https://api.github.com/users/lededje/received_events","type":"User","site_admin":false},"body":"Good practice for props on elements and components in react.\r\n\r\nOne I see quite a lot in pull requests is the last point.","created_at":"2016-08-10T10:57:23Z","updated_at":"2016-08-17T09:38:17Z","closed_at":null,"merged_at":null,"merge_commit_sha":"48e33192c7991c5973d1f8d3e00b55d3d7e57acd","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/deliveroo/deliveroo.engineering/pulls/15/commits","review_comments_url":"https://api.github.com/repos/deliveroo/deliveroo.engineering/pulls/15/comments","review_comment_url":"https://api.github.com/repos/deliveroo/deliveroo.engineering/pulls/comments{/number}","comments_url":"https://api.github.com/repos/deliveroo/deliveroo.engineering/issues/15/comments","statuses_url":"https://api.github.com/repos/deliveroo/deliveroo.engineering/statuses/02a3ad66154972db6e43f21514424ce698d57f14","head":{"label":"deliveroo:react-props","ref":"react-props","sha":"02a3ad66154972db6e43f21514424ce698d57f14","user":{"login":"deliveroo","id":10514109,"avatar_url":"https://avatars.githubusercontent.com/u/10514109?v=3","gravatar_id":"","url":"https://api.github.com/users/deliveroo","html_url":"https://github.com/deliveroo","followers_url":"https://api.github.com/users/deliveroo/followers","following_url":"https://api.github.com/users/deliveroo/following{/other_user}","gists_url":"https://api.github.com/users/deliveroo/gists{/gist_id}","starred_url":"https://api.github.com/users/deliveroo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/deliveroo/subscriptions","organizations_url":"https://api.github.com/users/deliveroo/orgs","repos_url":"https://api.github.com/users/deliveroo/repos","events_url":"https://api.github.com/users/deliveroo/events{/privacy}","received_events_url":"https://api.github.com/users/deliveroo/received_events","type":"Organization","site_admin":false},"repo":{"id":32532933,"name":"deliveroo.engineering","full_name":"deliveroo/deliveroo.engineering","owner":{"login":"deliveroo","id":10514109,"avatar_url":"https://avatars.githubusercontent.com/u/10514109?v=3","gravatar_id":"","url":"https://api.github.com/users/deliveroo","html_url":"https://github.com/deliveroo","followers_url":"https://api.github.com/users/deliveroo/followers","following_url":"https://api.github.com/users/deliveroo/following{/other_user}","gists_url":"https://api.github.com/users/deliveroo/gists{/gist_id}","starred_url":"https://api.github.com/users/deliveroo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/deliveroo/subscriptions","organizations_url":"https://api.github.com/users/deliveroo/orgs","repos_url":"https://api.github.com/users/deliveroo/repos","events_url":"https://api.github.com/users/deliveroo/events{/privacy}","received_events_url":"https://api.github.com/users/deliveroo/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/deliveroo/deliveroo.engineering","description":"Guidelines and conventions for good software at Deliveroo","fork":true,"url":"https://api.github.com/repos/deliveroo/deliveroo.engineering","forks_url":"https://api.github.com/repos/deliveroo/deliveroo.engineering/forks","keys_url":"https://api.github.com/repos/deliveroo/deliveroo.engineering/keys{/key_id}","collaborators_url":"https://api.github.com/repos/deliveroo/deliveroo.engineering/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/deliveroo/deliveroo.engineering/teams","hooks_url":"https://api.github.com/repos/deliveroo/deliveroo.engineering/hooks","issue_events_url":"https://api.github.com/repos/deliveroo/deliveroo.engineering/issues/events{/number}","events_url":"https://api.github.com/repos/deliveroo/deliveroo.engineering/events","assignees_url":"https://api.github.com/repos/deliveroo/deliveroo.engineering/assignees{/user}","branches_url":"https://api.github.com/repos/deliveroo/deliveroo.engineering/branches{/branch}","tags_url":"https://api.github.com/repos/deliveroo/deliveroo.engineering/tags","blobs_url":"https://api.github.com/repos/deliveroo/deliveroo.engineering/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/deliveroo/deliveroo.engineering/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/deliveroo/deliveroo.engineering/git/refs{/sha}","trees_url":"https://api.github.com/repos/deliveroo/deliveroo.engineering/git/trees{/sha}","statuses_url":"https://api.github.com/repos/deliveroo/deliveroo.engineering/statuses/{sha}","languages_url":"https://api.github.com/repos/deliveroo/deliveroo.engineering/languages","stargazers_url":"https://api.github.com/repos/deliveroo/deliveroo.engineering/stargazers","contributors_url":"https://api.github.com/repos/deliveroo/deliveroo.engineering/contributors","subscribers_url":"https://api.github.com/repos/deliveroo/deliveroo.engineering/subscribers","subscription_url":"https://api.github.com/repos/deliveroo/deliveroo.engineering/subscription","commits_url":"https://api.github.com/repos/deliveroo/deliveroo.engineering/commits{/sha}","git_commits_url":"https://api.github.com/repos/deliveroo/deliveroo.engineering/git/commits{/sha}","comments_url":"https://api.github.com/repos/deliveroo/deliveroo.engineering/comments{/number}","issue_comment_url":"https://api.github.com/repos/deliveroo/deliveroo.engineering/issues/comments{/number}","contents_url":"https://api.github.com/repos/deliveroo/deliveroo.engineering/contents/{+path}","compare_url":"https://api.github.com/repos/deliveroo/deliveroo.engineering/compare/{base}...{head}","merges_url":"https://api.github.com/repos/deliveroo/deliveroo.engineering/merges","archive_url":"https://api.github.com/repos/deliveroo/deliveroo.engineering/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/deliveroo/deliveroo.engineering/downloads","issues_url":"https://api.github.com/repos/deliveroo/deliveroo.engineering/issues{/number}","pulls_url":"https://api.github.com/repos/deliveroo/deliveroo.engineering/pulls{/number}","milestones_url":"https://api.github.com/repos/deliveroo/deliveroo.engineering/milestones{/number}","notifications_url":"https://api.github.com/repos/deliveroo/deliveroo.engineering/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/deliveroo/deliveroo.engineering/labels{/name}","releases_url":"https://api.github.com/repos/deliveroo/deliveroo.engineering/releases{/id}","deployments_url":"https://api.github.com/repos/deliveroo/deliveroo.engineering/deployments","created_at":"2015-03-19T16:23:28Z","updated_at":"2016-07-24T21:26:42Z","pushed_at":"2016-08-17T09:03:29Z","git_url":"git://github.com/deliveroo/deliveroo.engineering.git","ssh_url":"git@github.com:deliveroo/deliveroo.engineering.git","clone_url":"https://github.com/deliveroo/deliveroo.engineering.git","svn_url":"https://github.com/deliveroo/deliveroo.engineering","homepage":"","size":1477,"stargazers_count":7,"watchers_count":7,"language":"CSS","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":1,"mirror_url":null,"open_issues_count":11,"forks":1,"open_issues":11,"watchers":7,"default_branch":"gh-pages"}},"base":{"label":"deliveroo:gh-pages","ref":"gh-pages","sha":"f30505444e010f6664462871f8e0c1e654b4d131","user":{"login":"deliveroo","id":10514109,"avatar_url":"https://avatars.githubusercontent.com/u/10514109?v=3","gravatar_id":"","url":"https://api.github.com/users/deliveroo","html_url":"https://github.com/deliveroo","followers_url":"https://api.github.com/users/deliveroo/followers","following_url":"https://api.github.com/users/deliveroo/following{/other_user}","gists_url":"https://api.github.com/users/deliveroo/gists{/gist_id}","starred_url":"https://api.github.com/users/deliveroo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/deliveroo/subscriptions","organizations_url":"https://api.github.com/users/deliveroo/orgs","repos_url":"https://api.github.com/users/deliveroo/repos","events_url":"https://api.github.com/users/deliveroo/events{/privacy}","received_events_url":"https://api.github.com/users/deliveroo/received_events","type":"Organization","site_admin":false},"repo":{"id":32532933,"name":"deliveroo.engineering","full_name":"deliveroo/deliveroo.engineering","owner":{"login":"deliveroo","id":10514109,"avatar_url":"https://avatars.githubusercontent.com/u/10514109?v=3","gravatar_id":"","url":"https://api.github.com/users/deliveroo","html_url":"https://github.com/deliveroo","followers_url":"https://api.github.com/users/deliveroo/followers","following_url":"https://api.github.com/users/deliveroo/following{/other_user}","gists_url":"https://api.github.com/users/deliveroo/gists{/gist_id}","starred_url":"https://api.github.com/users/deliveroo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/deliveroo/subscriptions","organizations_url":"https://api.github.com/users/deliveroo/orgs","repos_url":"https://api.github.com/users/deliveroo/repos","events_url":"https://api.github.com/users/deliveroo/events{/privacy}","received_events_url":"https://api.github.com/users/deliveroo/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/deliveroo/deliveroo.engineering","description":"Guidelines and conventions for good software at Deliveroo","fork":true,"url":"https://api.github.com/repos/deliveroo/deliveroo.engineering","forks_url":"https://api.github.com/repos/deliveroo/deliveroo.engineering/forks","keys_url":"https://api.github.com/repos/deliveroo/deliveroo.engineering/keys{/key_id}","collaborators_url":"https://api.github.com/repos/deliveroo/deliveroo.engineering/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/deliveroo/deliveroo.engineering/teams","hooks_url":"https://api.github.com/repos/deliveroo/deliveroo.engineering/hooks","issue_events_url":"https://api.github.com/repos/deliveroo/deliveroo.engineering/issues/events{/number}","events_url":"https://api.github.com/repos/deliveroo/deliveroo.engineering/events","assignees_url":"https://api.github.com/repos/deliveroo/deliveroo.engineering/assignees{/user}","branches_url":"https://api.github.com/repos/deliveroo/deliveroo.engineering/branches{/branch}","tags_url":"https://api.github.com/repos/deliveroo/deliveroo.engineering/tags","blobs_url":"https://api.github.com/repos/deliveroo/deliveroo.engineering/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/deliveroo/deliveroo.engineering/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/deliveroo/deliveroo.engineering/git/refs{/sha}","trees_url":"https://api.github.com/repos/deliveroo/deliveroo.engineering/git/trees{/sha}","statuses_url":"https://api.github.com/repos/deliveroo/deliveroo.engineering/statuses/{sha}","languages_url":"https://api.github.com/repos/deliveroo/deliveroo.engineering/languages","stargazers_url":"https://api.github.com/repos/deliveroo/deliveroo.engineering/stargazers","contributors_url":"https://api.github.com/repos/deliveroo/deliveroo.engineering/contributors","subscribers_url":"https://api.github.com/repos/deliveroo/deliveroo.engineering/subscribers","subscription_url":"https://api.github.com/repos/deliveroo/deliveroo.engineering/subscription","commits_url":"https://api.github.com/repos/deliveroo/deliveroo.engineering/commits{/sha}","git_commits_url":"https://api.github.com/repos/deliveroo/deliveroo.engineering/git/commits{/sha}","comments_url":"https://api.github.com/repos/deliveroo/deliveroo.engineering/comments{/number}","issue_comment_url":"https://api.github.com/repos/deliveroo/deliveroo.engineering/issues/comments{/number}","contents_url":"https://api.github.com/repos/deliveroo/deliveroo.engineering/contents/{+path}","compare_url":"https://api.github.com/repos/deliveroo/deliveroo.engineering/compare/{base}...{head}","merges_url":"https://api.github.com/repos/deliveroo/deliveroo.engineering/merges","archive_url":"https://api.github.com/repos/deliveroo/deliveroo.engineering/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/deliveroo/deliveroo.engineering/downloads","issues_url":"https://api.github.com/repos/deliveroo/deliveroo.engineering/issues{/number}","pulls_url":"https://api.github.com/repos/deliveroo/deliveroo.engineering/pulls{/number}","milestones_url":"https://api.github.com/repos/deliveroo/deliveroo.engineering/milestones{/number}","notifications_url":"https://api.github.com/repos/deliveroo/deliveroo.engineering/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/deliveroo/deliveroo.engineering/labels{/name}","releases_url":"https://api.github.com/repos/deliveroo/deliveroo.engineering/releases{/id}","deployments_url":"https://api.github.com/repos/deliveroo/deliveroo.engineering/deployments","created_at":"2015-03-19T16:23:28Z","updated_at":"2016-07-24T21:26:42Z","pushed_at":"2016-08-17T09:03:29Z","git_url":"git://github.com/deliveroo/deliveroo.engineering.git","ssh_url":"git@github.com:deliveroo/deliveroo.engineering.git","clone_url":"https://github.com/deliveroo/deliveroo.engineering.git","svn_url":"https://github.com/deliveroo/deliveroo.engineering","homepage":"","size":1477,"stargazers_count":7,"watchers_count":7,"language":"CSS","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":1,"mirror_url":null,"open_issues_count":11,"forks":1,"open_issues":11,"watchers":7,"default_branch":"gh-pages"}},"_links":{"self":{"href":"https://api.github.com/repos/deliveroo/deliveroo.engineering/pulls/15"},"html":{"href":"https://github.com/deliveroo/deliveroo.engineering/pull/15"},"issue":{"href":"https://api.github.com/repos/deliveroo/deliveroo.engineering/issues/15"},"comments":{"href":"https://api.github.com/repos/deliveroo/deliveroo.engineering/issues/15/comments"},"review_comments":{"href":"https://api.github.com/repos/deliveroo/deliveroo.engineering/pulls/15/comments"},"review_comment":{"href":"https://api.github.com/repos/deliveroo/deliveroo.engineering/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/deliveroo/deliveroo.engineering/pulls/15/commits"},"statuses":{"href":"https://api.github.com/repos/deliveroo/deliveroo.engineering/statuses/02a3ad66154972db6e43f21514424ce698d57f14"}}}}
{"actor":{"display_login":"danielcooper"}}