{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/react/issues/3594","labels_url":"https://api.github.com/repos/facebook/react/issues/3594/labels{/name}","comments_url":"https://api.github.com/repos/facebook/react/issues/3594/comments","events_url":"https://api.github.com/repos/facebook/react/issues/3594/events","html_url":"https://github.com/facebook/react/issues/3594","id":66460626,"number":3594,"title":"<option value=\"foo\" selected> not rendering on the server","user":{"login":"mariuslundgard","id":406933,"avatar_url":"https://avatars.githubusercontent.com/u/406933?v=3","gravatar_id":"","url":"https://api.github.com/users/mariuslundgard","html_url":"https://github.com/mariuslundgard","followers_url":"https://api.github.com/users/mariuslundgard/followers","following_url":"https://api.github.com/users/mariuslundgard/following{/other_user}","gists_url":"https://api.github.com/users/mariuslundgard/gists{/gist_id}","starred_url":"https://api.github.com/users/mariuslundgard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mariuslundgard/subscriptions","organizations_url":"https://api.github.com/users/mariuslundgard/orgs","repos_url":"https://api.github.com/users/mariuslundgard/repos","events_url":"https://api.github.com/users/mariuslundgard/events{/privacy}","received_events_url":"https://api.github.com/users/mariuslundgard/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-04-05T17:10:01Z","updated_at":"2015-04-05T17:37:28Z","closed_at":null,"body":"I'm having an issue with a `<select>` element which is rendered both on the server and in the client. This example recreates the issue:\r\n\r\n``` jsx\r\nconst React = require('react');\r\n\r\nconst SelectedDebug = React.createClass({\r\n  displayName: 'SelectedDebug',\r\n\r\n  render() {\r\n    return (\r\n      <div>\r\n        <select value='C'>\r\n          <option value='A'>A</option>\r\n          <option value='B'>B</option>\r\n          <option value='C'>C</option>\r\n        </select>\r\n      </div>\r\n    );\r\n  }\r\n});\r\n\r\nmodule.exports = SelectedDebug;\r\n```\r\n\r\nThe `selected` attribute is *not* rendered on the server, but works fine in browser.\r\n\r\nI've also tried setting the `defaultValue` prop on the `<select>` element, which doesn't seem to make a difference. It render as expected when I use `<option value='C' selected>`, however, that of course throws a warning in the console telling me to use either the `value` or `defaultValue` prop.\r\n\r\nNote: this code is running in Node v0.12 using [Babel](https://github.com/babel/babel) for transpiling (tested both using React v0.12 & v0.13).\r\n\r\nAm I missing something, or is it a bug?"},"comment":{"url":"https://api.github.com/repos/facebook/react/issues/comments/89816875","html_url":"https://github.com/facebook/react/issues/3594#issuecomment-89816875","issue_url":"https://api.github.com/repos/facebook/react/issues/3594","id":89816875,"user":{"login":"mariuslundgard","id":406933,"avatar_url":"https://avatars.githubusercontent.com/u/406933?v=3","gravatar_id":"","url":"https://api.github.com/users/mariuslundgard","html_url":"https://github.com/mariuslundgard","followers_url":"https://api.github.com/users/mariuslundgard/followers","following_url":"https://api.github.com/users/mariuslundgard/following{/other_user}","gists_url":"https://api.github.com/users/mariuslundgard/gists{/gist_id}","starred_url":"https://api.github.com/users/mariuslundgard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mariuslundgard/subscriptions","organizations_url":"https://api.github.com/users/mariuslundgard/orgs","repos_url":"https://api.github.com/users/mariuslundgard/repos","events_url":"https://api.github.com/users/mariuslundgard/events{/privacy}","received_events_url":"https://api.github.com/users/mariuslundgard/received_events","type":"User","site_admin":false},"created_at":"2015-04-05T17:37:28Z","updated_at":"2015-04-05T17:37:28Z","body":"Looking at the source code, it looks as if the `selected` attribute is only added after the node is mounted. This snippet is from `src/browser/ui/dom/components/ReactDOMSelect.js`:\r\n\r\n``` js\r\n  componentDidMount: function() {\r\n    var value = LinkedValueUtils.getValue(this);\r\n    if (value != null) {\r\n      updateOptions(this, value);\r\n    } else if (this.props.defaultValue != null) {\r\n      updateOptions(this, this.props.defaultValue);\r\n    }\r\n  },\r\n```\r\n\r\nIs it like this for a reason?\r\n"}}