{"action":"closed","issue":{"url":"https://api.github.com/repos/gcanti/tcomb-react/issues/38","repository_url":"https://api.github.com/repos/gcanti/tcomb-react","labels_url":"https://api.github.com/repos/gcanti/tcomb-react/issues/38/labels{/name}","comments_url":"https://api.github.com/repos/gcanti/tcomb-react/issues/38/comments","events_url":"https://api.github.com/repos/gcanti/tcomb-react/issues/38/events","html_url":"https://github.com/gcanti/tcomb-react/issues/38","id":164646666,"number":38,"title":"What is the recommended way to transfer props to an underlying HTML element?","user":{"login":"jedmao","id":1058243,"avatar_url":"https://avatars.githubusercontent.com/u/1058243?v=3","gravatar_id":"","url":"https://api.github.com/users/jedmao","html_url":"https://github.com/jedmao","followers_url":"https://api.github.com/users/jedmao/followers","following_url":"https://api.github.com/users/jedmao/following{/other_user}","gists_url":"https://api.github.com/users/jedmao/gists{/gist_id}","starred_url":"https://api.github.com/users/jedmao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jedmao/subscriptions","organizations_url":"https://api.github.com/users/jedmao/orgs","repos_url":"https://api.github.com/users/jedmao/repos","events_url":"https://api.github.com/users/jedmao/events{/privacy}","received_events_url":"https://api.github.com/users/jedmao/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-07-09T03:11:44Z","updated_at":"2016-07-09T13:57:16Z","closed_at":"2016-07-09T13:57:16Z","body":"For example, say you want a component that renders a div and you want to allow any props that would normally be accepted for a div.\r\n\r\nI'm trying to avoid the following:\r\n```jsx\r\n    propTypes: propTypes(t.struct({\r\n        divProps: t.Any,\r\n        children: t.ReactChildren\r\n    })),\r\n\r\n    render() {\r\n        const { divProps, children } = this.props;\r\n        return (\r\n            <div {...divProps}>\r\n                {children}\r\n            </div>\r\n        );\r\n    },\r\n```\r\nI'd also like to avoid the following:\r\n\r\n```jsx\r\n    propTypes: propTypes(t.struct({\r\n        children: t.ReactChildren\r\n    }), { strict: false }),\r\n\r\n    render() {\r\n        return (<div {...this.props} />);\r\n    },\r\n```\r\nWould this, perhaps, require a separate tcomb library that does not yet exist, like `tcomb-html` or `tcomb-dom`? This way, you could do something like:\r\n```jsx\r\n    propTypes: propTypes(t.struct({\r\n        divProps: tdom.DivProps,\r\n        children: t.ReactChildren\r\n    })),\r\n\r\n    render() {\r\n        const { divProps, children } = this.props;\r\n        return (\r\n            <div {...divProps}>\r\n                {children}\r\n            </div>\r\n        );\r\n    },\r\n```\r\nIn this case, the `DivProps` would be a sub-type of [`GlobalAttributes`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes).\r\n\r\nSee also: [React: Transferring Props: A Shortcut](https://facebook.github.io/react/docs/reusable-components.html#transferring-props-a-shortcut)."}}
{"actor":{"display_login":"jedmao"}}