{"action":"created","issue":{"url":"https://api.github.com/repos/gaearon/react-dnd/issues/212","labels_url":"https://api.github.com/repos/gaearon/react-dnd/issues/212/labels{/name}","comments_url":"https://api.github.com/repos/gaearon/react-dnd/issues/212/comments","events_url":"https://api.github.com/repos/gaearon/react-dnd/issues/212/events","html_url":"https://github.com/gaearon/react-dnd/issues/212","id":91317902,"number":212,"title":"Is it possible to define DropTarget type via props?","user":{"login":"globexdesigns","id":226640,"avatar_url":"https://avatars.githubusercontent.com/u/226640?v=3","gravatar_id":"","url":"https://api.github.com/users/globexdesigns","html_url":"https://github.com/globexdesigns","followers_url":"https://api.github.com/users/globexdesigns/followers","following_url":"https://api.github.com/users/globexdesigns/following{/other_user}","gists_url":"https://api.github.com/users/globexdesigns/gists{/gist_id}","starred_url":"https://api.github.com/users/globexdesigns/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/globexdesigns/subscriptions","organizations_url":"https://api.github.com/users/globexdesigns/orgs","repos_url":"https://api.github.com/users/globexdesigns/repos","events_url":"https://api.github.com/users/globexdesigns/events{/privacy}","received_events_url":"https://api.github.com/users/globexdesigns/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-06-26T17:43:43Z","updated_at":"2015-06-26T18:17:38Z","closed_at":null,"body":"I have created a re-usable Sortable component using the example in react-dnd, however, I'd like to make it so that each Sortable list can only accept items in that list (ie. you should not be able to drag an item from Sortable list A into Sortable list B).\r\n\r\nBecause the \"type\" is defined as the first parameter in the decorator, I can't figure out how to restrict to the parent component using passed in prop. Is it possible to define the \"type\" in the DropTarget via that component's prop? Or is there some other way I can change that \"type\" based on the component that is rendering it.\r\n\r\n```\r\n// Something like this, where 'accepts' defines the types of drag\r\n<Sortable accepts=\"A\" items=[...] />\r\n<Sortable accepts=\"B\" items=[...] />\r\n\r\n// Then in the component definition, I'd like to use \"this.props.accepts\" that come in...\r\n@DropTarget(this.props.accepts, ..., ...)\r\nexport default class Sortable extends Component {\r\n     ...\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/gaearon/react-dnd/issues/comments/115822764","html_url":"https://github.com/gaearon/react-dnd/issues/212#issuecomment-115822764","issue_url":"https://api.github.com/repos/gaearon/react-dnd/issues/212","id":115822764,"user":{"login":"vkbansal","id":5930351,"avatar_url":"https://avatars.githubusercontent.com/u/5930351?v=3","gravatar_id":"","url":"https://api.github.com/users/vkbansal","html_url":"https://github.com/vkbansal","followers_url":"https://api.github.com/users/vkbansal/followers","following_url":"https://api.github.com/users/vkbansal/following{/other_user}","gists_url":"https://api.github.com/users/vkbansal/gists{/gist_id}","starred_url":"https://api.github.com/users/vkbansal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vkbansal/subscriptions","organizations_url":"https://api.github.com/users/vkbansal/orgs","repos_url":"https://api.github.com/users/vkbansal/repos","events_url":"https://api.github.com/users/vkbansal/events{/privacy}","received_events_url":"https://api.github.com/users/vkbansal/received_events","type":"User","site_admin":false},"created_at":"2015-06-26T18:17:38Z","updated_at":"2015-06-26T18:17:38Z","body":"Yes that is possible. You need to use a function.\r\n```js\r\n@DropTarget((props) => { return props.accepts; }, ..., ...)\r\nexport default class Sortable extends Component {\r\n     ...\r\n}\r\n```\r\n"}}