{"action":"created","issue":{"url":"https://api.github.com/repos/callemall/material-ui/issues/3705","repository_url":"https://api.github.com/repos/callemall/material-ui","labels_url":"https://api.github.com/repos/callemall/material-ui/issues/3705/labels{/name}","comments_url":"https://api.github.com/repos/callemall/material-ui/issues/3705/comments","events_url":"https://api.github.com/repos/callemall/material-ui/issues/3705/events","html_url":"https://github.com/callemall/material-ui/pull/3705","id":141083449,"number":3705,"title":"[PropTypes] Name PropTypes imports","user":{"login":"stephenburgess8","id":6003351,"avatar_url":"https://avatars.githubusercontent.com/u/6003351?v=3","gravatar_id":"","url":"https://api.github.com/users/stephenburgess8","html_url":"https://github.com/stephenburgess8","followers_url":"https://api.github.com/users/stephenburgess8/followers","following_url":"https://api.github.com/users/stephenburgess8/following{/other_user}","gists_url":"https://api.github.com/users/stephenburgess8/gists{/gist_id}","starred_url":"https://api.github.com/users/stephenburgess8/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stephenburgess8/subscriptions","organizations_url":"https://api.github.com/users/stephenburgess8/orgs","repos_url":"https://api.github.com/users/stephenburgess8/repos","events_url":"https://api.github.com/users/stephenburgess8/events{/privacy}","received_events_url":"https://api.github.com/users/stephenburgess8/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/callemall/material-ui/labels/PR:%20Needs%20Revision","name":"PR: Needs Revision","color":"e11d21"},{"url":"https://api.github.com/repos/callemall/material-ui/labels/Refactoring","name":"Refactoring","color":"bb7704"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":15,"created_at":"2016-03-15T20:02:02Z","updated_at":"2016-04-12T18:18:30Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/callemall/material-ui/pulls/3705","html_url":"https://github.com/callemall/material-ui/pull/3705","diff_url":"https://github.com/callemall/material-ui/pull/3705.diff","patch_url":"https://github.com/callemall/material-ui/pull/3705.patch"},"body":"- [x] PR has tests / docs demo, and is linted.\r\n- [ ] Commit and PR titles begin with [ComponentName], and are in imperative form: \"[Component] Fix leaky abstraction\".\r\n- [ ] Description explains the issue / use-case resolved, and auto-closes the related issue(s) (http://tr.im/vFqem).\r\n\r\nWould using named imports affect speed? Is there a compelling stylistic or architectural reason for using a named import of `import {PropTypes} from 'react'` or the alternative of repeatedly calling `React.PropTypes.{...}`?\r\n\r\nFor instance with a named import of `import {PropType} from 'react'`, the PropTypes declaration would look like\r\n\r\n```\r\npropTypes: {\r\n  location: PropTypes.object.isRequired,\r\n  onRequestChangeList: PropTypes.func.isRequired,\r\n  open: PropTypes.bool.isRequired,\r\n}\r\n```\r\nand with a default export of `import React from 'react'` it would look like\r\n```\r\npropTypes: {\r\n  location: React.PropTypes.object.isRequired,\r\n  onRequestChangeList: React.PropTypes.func.isRequired,\r\n  open: React.PropTypes.bool.isRequired,\r\n}\r\n```\r\n\r\nIn [this excellent question](http://programmers.stackexchange.com/questions/187403/import-module-vs-from-module-import-function) from 2013 on `import module` vs. `from module import function` in Python, the answers seem to center mostly on stylistic and architectural reasons for choosing between default and named imports. Is this true in React as well or is there a difference in performance? \r\n\r\nThis PR reduces the size of the MUI source code by 7335 bytes using the named import over about 2,300 lines.\r\n\r\nMake code cleaner by eliminating clutter of calling PropTypes from React default import. Use named import of `{PropTypes}`. Rename MUI custom `PropTypes` to `MuiPropTypes` to avoid conflict. Fix linting errors in `src/svg-icons/index.js`.\r\n\r\nUPDATE: Both versions render in the same amount of time when averaged (2.4s). The new rendered version drops the package from 6.9mb to 6.8mb, with a difference in the size of app.js of 21.39kb."},"comment":{"url":"https://api.github.com/repos/callemall/material-ui/issues/comments/209039802","html_url":"https://github.com/callemall/material-ui/pull/3705#issuecomment-209039802","issue_url":"https://api.github.com/repos/callemall/material-ui/issues/3705","id":209039802,"user":{"login":"nathanmarks","id":4420103,"avatar_url":"https://avatars.githubusercontent.com/u/4420103?v=3","gravatar_id":"","url":"https://api.github.com/users/nathanmarks","html_url":"https://github.com/nathanmarks","followers_url":"https://api.github.com/users/nathanmarks/followers","following_url":"https://api.github.com/users/nathanmarks/following{/other_user}","gists_url":"https://api.github.com/users/nathanmarks/gists{/gist_id}","starred_url":"https://api.github.com/users/nathanmarks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nathanmarks/subscriptions","organizations_url":"https://api.github.com/users/nathanmarks/orgs","repos_url":"https://api.github.com/users/nathanmarks/repos","events_url":"https://api.github.com/users/nathanmarks/events{/privacy}","received_events_url":"https://api.github.com/users/nathanmarks/received_events","type":"User","site_admin":false},"created_at":"2016-04-12T18:18:29Z","updated_at":"2016-04-12T18:18:29Z","body":"@oliviertassinari especially using the transform :+1: "}}