{"action":"created","issue":{"url":"https://api.github.com/repos/yahoo/react-intl/issues/315","repository_url":"https://api.github.com/repos/yahoo/react-intl","labels_url":"https://api.github.com/repos/yahoo/react-intl/issues/315/labels{/name}","comments_url":"https://api.github.com/repos/yahoo/react-intl/issues/315/comments","events_url":"https://api.github.com/repos/yahoo/react-intl/issues/315/events","html_url":"https://github.com/yahoo/react-intl/issues/315","id":132780656,"number":315,"title":"React Intl puts things on components' state and Jest tests fail","user":{"login":"alejandroiglesias","id":480640,"avatar_url":"https://avatars.githubusercontent.com/u/480640?v=3","gravatar_id":"","url":"https://api.github.com/users/alejandroiglesias","html_url":"https://github.com/alejandroiglesias","followers_url":"https://api.github.com/users/alejandroiglesias/followers","following_url":"https://api.github.com/users/alejandroiglesias/following{/other_user}","gists_url":"https://api.github.com/users/alejandroiglesias/gists{/gist_id}","starred_url":"https://api.github.com/users/alejandroiglesias/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alejandroiglesias/subscriptions","organizations_url":"https://api.github.com/users/alejandroiglesias/orgs","repos_url":"https://api.github.com/users/alejandroiglesias/repos","events_url":"https://api.github.com/users/alejandroiglesias/events{/privacy}","received_events_url":"https://api.github.com/users/alejandroiglesias/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/yahoo/react-intl/labels/support","name":"support","color":"f7c6c7"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2016-02-10T18:29:33Z","updated_at":"2016-02-11T00:41:24Z","closed_at":"2016-02-10T23:30:54Z","body":"Hi, I was trying to run/fix all my (Jest) unit tests. Got them to run (see #308) but now they fail because i cannot check for components' state since it seems to be altered by React Intl.\r\nHere's an example:\r\n\r\n```\r\n FAIL  public/scripts/comment/__tests__/CommentForm-test.js (1.537s)\r\n● CommentForm component › it sets a default initial state\r\n  - Expected: {\r\n    | getDateTimeFormat: undefined,\r\n    | getMessageFormat: undefined,\r\n    | getNumberFormat: undefined,\r\n    | getPluralFormat: undefined,\r\n    | getRelativeFormat: undefined,\r\n    | now: Function\r\n    } toEqual: {\r\n    | author: '',\r\n    | text: ''\r\n    }\r\n```\r\n\r\nSince i'm new to React (coming from Angular) i'm wondering if it really is a good practice to put things on component state (in other words, \"pollute\" the state). Wouldn't make more sense to use, say, `myComponentInstance.getMessageFormat` rather than `myComponentInstance.state.getMessageFormat`? Also, why are they declared as `undefined`?\r\n\r\nAny help is appreciated. Thanks in advance."},"comment":{"url":"https://api.github.com/repos/yahoo/react-intl/issues/comments/182658214","html_url":"https://github.com/yahoo/react-intl/issues/315#issuecomment-182658214","issue_url":"https://api.github.com/repos/yahoo/react-intl/issues/315","id":182658214,"user":{"login":"alejandroiglesias","id":480640,"avatar_url":"https://avatars.githubusercontent.com/u/480640?v=3","gravatar_id":"","url":"https://api.github.com/users/alejandroiglesias","html_url":"https://github.com/alejandroiglesias","followers_url":"https://api.github.com/users/alejandroiglesias/followers","following_url":"https://api.github.com/users/alejandroiglesias/following{/other_user}","gists_url":"https://api.github.com/users/alejandroiglesias/gists{/gist_id}","starred_url":"https://api.github.com/users/alejandroiglesias/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alejandroiglesias/subscriptions","organizations_url":"https://api.github.com/users/alejandroiglesias/orgs","repos_url":"https://api.github.com/users/alejandroiglesias/repos","events_url":"https://api.github.com/users/alejandroiglesias/events{/privacy}","received_events_url":"https://api.github.com/users/alejandroiglesias/received_events","type":"User","site_admin":false},"created_at":"2016-02-11T00:41:24Z","updated_at":"2016-02-11T00:41:24Z","body":"Also, do functions make the state of the component? Shouldn't be pure (\"JSON-serializable\", [according to the docs](https://facebook.github.io/react/docs/interactivity-and-dynamic-uis.html#what-should-go-in-state)) data? Also [in the docs](https://facebook.github.io/react/tips/expose-component-functions.html) they mention exposing component functions but they don't use state.\r\nSo i'm missing a point here?\r\nThanks."}}