{"action":"opened","issue":{"url":"https://api.github.com/repos/nihey/react-clipboard/issues/4","labels_url":"https://api.github.com/repos/nihey/react-clipboard/issues/4/labels{/name}","comments_url":"https://api.github.com/repos/nihey/react-clipboard/issues/4/comments","events_url":"https://api.github.com/repos/nihey/react-clipboard/issues/4/events","html_url":"https://github.com/nihey/react-clipboard/issues/4","id":110560379,"number":4,"title":"API Changes","user":{"login":"nihey","id":5278570,"avatar_url":"https://avatars.githubusercontent.com/u/5278570?v=3","gravatar_id":"","url":"https://api.github.com/users/nihey","html_url":"https://github.com/nihey","followers_url":"https://api.github.com/users/nihey/followers","following_url":"https://api.github.com/users/nihey/following{/other_user}","gists_url":"https://api.github.com/users/nihey/gists{/gist_id}","starred_url":"https://api.github.com/users/nihey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nihey/subscriptions","organizations_url":"https://api.github.com/users/nihey/orgs","repos_url":"https://api.github.com/users/nihey/repos","events_url":"https://api.github.com/users/nihey/events{/privacy}","received_events_url":"https://api.github.com/users/nihey/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/nihey/react-clipboard/labels/question","name":"question","color":"cc317c"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-10-08T23:22:20Z","updated_at":"2015-10-08T23:22:20Z","closed_at":null,"body":"I was thinking about changing the API a little bit so that a clipboard option insertion would be made easier:\r\n\r\nToday we have:\r\n```\r\nvar MyView = React.createClass({\r\n  clipboardOptions: {\r\n    text: function() {\r\n      return \"Dynamic content copying\"\r\n    },\r\n  },\r\n\r\n  render: function() {\r\n    return <div>\r\n      <ClipboardButton options={this.clipboardOptions}>\r\n        copy to clipboard\r\n      </ClipboardButton>\r\n    </div>;\r\n  },\r\n});\r\n```\r\n\r\nI would change it to:\r\n\r\n```\r\nvar MyView = React.createClass({\r\n  getText: function() {\r\n    return \"Dynamic content copying\";\r\n  },\r\n\r\n  render: function() {\r\n    return <div>\r\n      <ClipboardButton options-text={this.getText}>\r\n        copy to clipboard\r\n      </ClipboardButton>\r\n    </div>;\r\n  },\r\n});\r\n```\r\n\r\nSo that everything that was inside `this.props.options` would now come from `this.props['options-*']`"}}