{"action":"created","issue":{"url":"https://api.github.com/repos/SoAanyip/React-FileUpload/issues/6","repository_url":"https://api.github.com/repos/SoAanyip/React-FileUpload","labels_url":"https://api.github.com/repos/SoAanyip/React-FileUpload/issues/6/labels{/name}","comments_url":"https://api.github.com/repos/SoAanyip/React-FileUpload/issues/6/comments","events_url":"https://api.github.com/repos/SoAanyip/React-FileUpload/issues/6/events","html_url":"https://github.com/SoAanyip/React-FileUpload/issues/6","id":163567044,"number":6,"title":"Uncaught TypeError: Cannot read property 'ref' of null","user":{"login":"Guibod","id":840033,"avatar_url":"https://avatars.githubusercontent.com/u/840033?v=3","gravatar_id":"","url":"https://api.github.com/users/Guibod","html_url":"https://github.com/Guibod","followers_url":"https://api.github.com/users/Guibod/followers","following_url":"https://api.github.com/users/Guibod/following{/other_user}","gists_url":"https://api.github.com/users/Guibod/gists{/gist_id}","starred_url":"https://api.github.com/users/Guibod/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Guibod/subscriptions","organizations_url":"https://api.github.com/users/Guibod/orgs","repos_url":"https://api.github.com/users/Guibod/repos","events_url":"https://api.github.com/users/Guibod/events{/privacy}","received_events_url":"https://api.github.com/users/Guibod/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-07-03T15:32:48Z","updated_at":"2016-07-04T13:42:56Z","closed_at":null,"body":"If your FileUpload node contains NULL child, a TypeError is raised.\r\n\r\n```\r\n            React.Children.forEach(props.children, function (child) {\r\n                if (child.ref == 'chooseAndUpload') {\r\n                    chooseBtn = child;\r\n                    flag++;\r\n                } else {\r\n                    flag == 0 ? before.push(child) : flag == 1 ? middle.push(child) : '';\r\n                }\r\n            });\r\n```\r\n\r\nIt's a common feature to prepare optional element and initialize them as null. Would it be possible to force check that `child` is not null ?\r\n\r\nFor instance:\r\n\r\n```\r\nrender() {\r\n  let myOptionalElement = null;\r\n  if (false) {\r\n    myOptionalElement = <span>i'm optional</span>\r\n  }\r\n  return (\r\n    <FileUpload>\r\n      {myOptionalElement}\r\n    </FileUpload>\r\n  );\r\n}\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/SoAanyip/React-FileUpload/issues/comments/230293739","html_url":"https://github.com/SoAanyip/React-FileUpload/issues/6#issuecomment-230293739","issue_url":"https://api.github.com/repos/SoAanyip/React-FileUpload/issues/6","id":230293739,"user":{"login":"SoAanyip","id":7396646,"avatar_url":"https://avatars.githubusercontent.com/u/7396646?v=3","gravatar_id":"","url":"https://api.github.com/users/SoAanyip","html_url":"https://github.com/SoAanyip","followers_url":"https://api.github.com/users/SoAanyip/followers","following_url":"https://api.github.com/users/SoAanyip/following{/other_user}","gists_url":"https://api.github.com/users/SoAanyip/gists{/gist_id}","starred_url":"https://api.github.com/users/SoAanyip/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SoAanyip/subscriptions","organizations_url":"https://api.github.com/users/SoAanyip/orgs","repos_url":"https://api.github.com/users/SoAanyip/repos","events_url":"https://api.github.com/users/SoAanyip/events{/privacy}","received_events_url":"https://api.github.com/users/SoAanyip/received_events","type":"User","site_admin":false},"created_at":"2016-07-04T13:42:56Z","updated_at":"2016-07-04T13:42:56Z","body":"@Guibod It is my mistake that did not check the type. Now fixing! Thanks for your issue:smile:!"}}
{"actor":{"display_login":"SoAanyip"}}