{"action":"created","issue":{"url":"https://api.github.com/repos/arkency/reactjs_koans/issues/44","labels_url":"https://api.github.com/repos/arkency/reactjs_koans/issues/44/labels{/name}","comments_url":"https://api.github.com/repos/arkency/reactjs_koans/issues/44/comments","events_url":"https://api.github.com/repos/arkency/reactjs_koans/issues/44/events","html_url":"https://github.com/arkency/reactjs_koans/issues/44","id":108772212,"number":44,"title":"Simpler solution for Grocery Challenge Part 4?","user":{"login":"bronson","id":1776,"avatar_url":"https://avatars.githubusercontent.com/u/1776?v=3","gravatar_id":"","url":"https://api.github.com/users/bronson","html_url":"https://github.com/bronson","followers_url":"https://api.github.com/users/bronson/followers","following_url":"https://api.github.com/users/bronson/following{/other_user}","gists_url":"https://api.github.com/users/bronson/gists{/gist_id}","starred_url":"https://api.github.com/users/bronson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bronson/subscriptions","organizations_url":"https://api.github.com/users/bronson/orgs","repos_url":"https://api.github.com/users/bronson/repos","events_url":"https://api.github.com/users/bronson/events{/privacy}","received_events_url":"https://api.github.com/users/bronson/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/arkency/reactjs_koans/labels/support","name":"support","color":"d4c5f9"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-09-29T00:25:11Z","updated_at":"2015-09-30T14:13:55Z","closed_at":null,"body":"You say:\r\n\r\n```js\r\n  // Fill the definition of the following method to allow completing each item\r\n  // Hint 1: Pay attention to the element's index on the list.\r\n```\r\n\r\nThis is what I came up with:\r\n\r\n```js\r\n  toggleGroceryCompleteness(groceryIndex) {\r\n    var newState = React.addons.update(this.state, {\r\n      groceries: {[groceryIndex]: {completed: {$set: true}}}\r\n    });\r\n    this.setState(newState)\r\n  }\r\n```\r\n\r\nBut this seems odd because you never told us about React.addons.update.\r\n\r\nIs there a simpler solution that I'm overlooking?  Thanks!"},"comment":{"url":"https://api.github.com/repos/arkency/reactjs_koans/issues/comments/144423030","html_url":"https://github.com/arkency/reactjs_koans/issues/44#issuecomment-144423030","issue_url":"https://api.github.com/repos/arkency/reactjs_koans/issues/44","id":144423030,"user":{"login":"bronson","id":1776,"avatar_url":"https://avatars.githubusercontent.com/u/1776?v=3","gravatar_id":"","url":"https://api.github.com/users/bronson","html_url":"https://github.com/bronson","followers_url":"https://api.github.com/users/bronson/followers","following_url":"https://api.github.com/users/bronson/following{/other_user}","gists_url":"https://api.github.com/users/bronson/gists{/gist_id}","starred_url":"https://api.github.com/users/bronson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bronson/subscriptions","organizations_url":"https://api.github.com/users/bronson/orgs","repos_url":"https://api.github.com/users/bronson/repos","events_url":"https://api.github.com/users/bronson/events{/privacy}","received_events_url":"https://api.github.com/users/bronson/received_events","type":"User","site_admin":false},"created_at":"2015-09-30T14:13:55Z","updated_at":"2015-09-30T14:13:55Z","body":"Pretty sure this solution violates the \"*NEVER mutate this.state directly*\" warning, doesn't it?\r\n\r\nhttps://facebook.github.io/react/docs/component-api.html\r\n\r\n(sure, it's probably safe here where updates will never happen very fast, but that seems a bad habit to get into...)"}}