{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/react/issues/3418","labels_url":"https://api.github.com/repos/facebook/react/issues/3418/labels{/name}","comments_url":"https://api.github.com/repos/facebook/react/issues/3418/comments","events_url":"https://api.github.com/repos/facebook/react/issues/3418/events","html_url":"https://github.com/facebook/react/issues/3418","id":61881660,"number":3418,"title":"replaceState throws away functions in 0.13","user":{"login":"WishCow","id":969284,"avatar_url":"https://avatars.githubusercontent.com/u/969284?v=3","gravatar_id":"","url":"https://api.github.com/users/WishCow","html_url":"https://github.com/WishCow","followers_url":"https://api.github.com/users/WishCow/followers","following_url":"https://api.github.com/users/WishCow/following{/other_user}","gists_url":"https://api.github.com/users/WishCow/gists{/gist_id}","starred_url":"https://api.github.com/users/WishCow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WishCow/subscriptions","organizations_url":"https://api.github.com/users/WishCow/orgs","repos_url":"https://api.github.com/users/WishCow/repos","events_url":"https://api.github.com/users/WishCow/events{/privacy}","received_events_url":"https://api.github.com/users/WishCow/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/facebook/react/labels/Type:%20Bug","name":"Type: Bug","color":"fc2929"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":20,"created_at":"2015-03-15T18:50:25Z","updated_at":"2015-08-25T16:49:11Z","closed_at":"2015-05-08T20:16:43Z","body":"I'm still learning React, so it's possible I'm misunderstanding something.\r\n\r\nI'm trying to use React with Immutable.js, and hit a stumbling block, by upgrading to React 0.13. There is [wiki page](https://github.com/facebook/immutable-js/wiki/Immutable-as-React-state) on the immutable.js repository, that explains how to use immutable as a react state, and it provides the following example (I transpiled it to ES3):\r\n\r\n```js\r\n'use strict';\r\n\r\nvar React = require('react');\r\nvar Immutable = require('immutable');\r\n\r\nvar Component = React.createClass({\r\n\r\n  getInitialState: function() {\r\n    return Immutable.Map({count:0});\r\n  },\r\n\r\n  handleClick: function() {\r\n    this.replaceState(this.state.update('count', function(v) { return v + 1 }));\r\n  },\r\n\r\n  render: function() {\r\n    return (\r\n      <div onClick={this.handleClick}>\r\n        {this.state.get('count')}\r\n      </div>\r\n    );\r\n  }\r\n\r\n});\r\n\r\nReact.render(<Component />, document.body);\r\n```\r\n\r\nThis works great in 0.12, but in 0.13, you will receive the following error when clicking on the div:\r\n```\r\nTypeError: this.state.get is not a function\r\nthis.state.get('count')\r\n```\r\nPutting a breakpoint on the error, and inspecting this.state with a debugger reveals that all the methods on this.state have disappeared.\r\n\r\nIs this the expected behavior in 0.13?"},"comment":{"url":"https://api.github.com/repos/facebook/react/issues/comments/134667751","html_url":"https://github.com/facebook/react/issues/3418#issuecomment-134667751","issue_url":"https://api.github.com/repos/facebook/react/issues/3418","id":134667751,"user":{"login":"spicyj","id":6820,"avatar_url":"https://avatars.githubusercontent.com/u/6820?v=3","gravatar_id":"","url":"https://api.github.com/users/spicyj","html_url":"https://github.com/spicyj","followers_url":"https://api.github.com/users/spicyj/followers","following_url":"https://api.github.com/users/spicyj/following{/other_user}","gists_url":"https://api.github.com/users/spicyj/gists{/gist_id}","starred_url":"https://api.github.com/users/spicyj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spicyj/subscriptions","organizations_url":"https://api.github.com/users/spicyj/orgs","repos_url":"https://api.github.com/users/spicyj/repos","events_url":"https://api.github.com/users/spicyj/events{/privacy}","received_events_url":"https://api.github.com/users/spicyj/received_events","type":"User","site_admin":false},"created_at":"2015-08-25T16:49:11Z","updated_at":"2015-08-25T16:49:11Z","body":"setState merges. Using a non-plain object with it isn't supported. You can put whatever object you want on an inner state key (this.state.data, this.state.map, etc.)."}}