{"action":"opened","issue":{"url":"https://api.github.com/repos/Yapp-Web5/Druwa-WEB/issues/21","repository_url":"https://api.github.com/repos/Yapp-Web5/Druwa-WEB","labels_url":"https://api.github.com/repos/Yapp-Web5/Druwa-WEB/issues/21/labels{/name}","comments_url":"https://api.github.com/repos/Yapp-Web5/Druwa-WEB/issues/21/comments","events_url":"https://api.github.com/repos/Yapp-Web5/Druwa-WEB/issues/21/events","html_url":"https://github.com/Yapp-Web5/Druwa-WEB/issues/21","id":368480405,"node_id":"MDU6SXNzdWUzNjg0ODA0MDU=","number":21,"title":"Do you have reason for using `class.defaultProps = defaultProps` instead of `static defaultProps`? ","user":{"login":"SoYoung210","id":18658235,"node_id":"MDQ6VXNlcjE4NjU4MjM1","avatar_url":"https://avatars0.githubusercontent.com/u/18658235?v=4","gravatar_id":"","url":"https://api.github.com/users/SoYoung210","html_url":"https://github.com/SoYoung210","followers_url":"https://api.github.com/users/SoYoung210/followers","following_url":"https://api.github.com/users/SoYoung210/following{/other_user}","gists_url":"https://api.github.com/users/SoYoung210/gists{/gist_id}","starred_url":"https://api.github.com/users/SoYoung210/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SoYoung210/subscriptions","organizations_url":"https://api.github.com/users/SoYoung210/orgs","repos_url":"https://api.github.com/users/SoYoung210/repos","events_url":"https://api.github.com/users/SoYoung210/events{/privacy}","received_events_url":"https://api.github.com/users/SoYoung210/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-10-10T03:31:40Z","updated_at":"2018-10-10T03:31:40Z","closed_at":null,"author_association":"NONE","body":"Hi! Im Soyoung, FE developer in YAPP Team4.\r\nPrior to my question, I would appreciate your understanding that my English is not great. \r\n\r\nI have seen that you have created default Props for all components in the following way:\r\n\r\n\r\n1.\r\nhttps://github.com/Yapp-Web5/Druwa-WEB/blob/286f9fd2e10de915816697565041ee68bfc66bbf/src/components/Highlight/Highlight.jsx#L8\r\n\r\n```jsx\r\nHighlight.defaultProps = defaultProps;\r\nHighlight.propTypes = propTypes;\r\n```\r\n\r\n\r\nI wrote the code in the same way as above, but recently I was recommended the following method.\r\n\r\n2.\r\n```jsx\r\nclass Slider extends PureComponent {\r\n  static propTypes = {\r\n    className: PropTypes.string,\r\n    max: PropTypes.number.isRequired,\r\n    onChange: PropTypes.func.isRequired,\r\n    value: PropTypes.number.isRequired\r\n  }\r\n  static defaultProps = {\r\n    className: \"\"\r\n  }\r\n}\r\n{ /* ... skip */ }\r\n```\r\n\r\nIm not good at Vanila Javascript, so i want to know **what difference** between 1 and 2. \r\n\r\nI read some documents, but I did not understand well.\r\nThis is the article I read. \r\n\r\n> https://medium.com/@martin_hotell/react-typescript-and-defaultprops-dilemma-ca7f81c661c7\r\nhttps://engineering.musefind.com/our-best-practices-for-writing-react-components-dec3eb5c3fc8\r\n\r\nIf you have a special reason about using `1`, please explain to me. It will help my javascript skills.\r\n\r\nThx! "}}
{"actor":{"display_login":"SoYoung210"}}