{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/react/issues/11116","repository_url":"https://api.github.com/repos/facebook/react","labels_url":"https://api.github.com/repos/facebook/react/issues/11116/labels{/name}","comments_url":"https://api.github.com/repos/facebook/react/issues/11116/comments","events_url":"https://api.github.com/repos/facebook/react/issues/11116/events","html_url":"https://github.com/facebook/react/issues/11116","id":263157629,"number":11116,"title":"Using setState inside a \"function as child component\" generates a warning about functions not being valid children","user":{"login":"CharlesMangwa","id":8975443,"avatar_url":"https://avatars0.githubusercontent.com/u/8975443?v=4","gravatar_id":"","url":"https://api.github.com/users/CharlesMangwa","html_url":"https://github.com/CharlesMangwa","followers_url":"https://api.github.com/users/CharlesMangwa/followers","following_url":"https://api.github.com/users/CharlesMangwa/following{/other_user}","gists_url":"https://api.github.com/users/CharlesMangwa/gists{/gist_id}","starred_url":"https://api.github.com/users/CharlesMangwa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CharlesMangwa/subscriptions","organizations_url":"https://api.github.com/users/CharlesMangwa/orgs","repos_url":"https://api.github.com/users/CharlesMangwa/repos","events_url":"https://api.github.com/users/CharlesMangwa/events{/privacy}","received_events_url":"https://api.github.com/users/CharlesMangwa/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":9,"created_at":"2017-10-05T14:58:10Z","updated_at":"2017-10-05T21:06:52Z","closed_at":"2017-10-05T16:20:03Z","author_association":"NONE","body":"**Do you want to request a *feature* or report a *bug*?**\r\n\r\nReporting a **bug**.\r\n\r\n**What is the current behavior?**\r\n\r\n_Context: React Native app, but the error isn't related to the renderer_\r\n\r\nI'm using a handcrafted `<Fetch path=\"/api/route\" render={this.renderChildren} />` component which fetches data and passes it to a ''function as child component\", which is rendered. However when using `setState` to save the call result, I get a pretty interesting error as you can see:\r\n\r\n<img width=\"418\" alt=\"screenshot of the code leading to the error\" src=\"https://user-images.githubusercontent.com/8975443/31232986-b3805930-a9eb-11e7-80ce-63a15ba3d24c.png\">\r\n\r\n👇 gives you 👇 \r\n\r\n<img width=\"418\" alt=\"screenshot of the error\" src=\"https://user-images.githubusercontent.com/8975443/31233024-cafc2d6e-a9eb-11e7-8a3e-63cbc9516e3d.png\">\r\n\r\n**If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via https://jsfiddle.net or similar (template for React 16: https://jsfiddle.net/Luktwrdm/, template for React 15: https://jsfiddle.net/hmbg7e9w/).**\r\n\r\nI tried to remove all the business logic and reproduce the error from my React Native app. Here is a CodeSandbox which fully reproduce it: https://codesandbox.io/s/pmo6okkz1x. \r\n\r\n**What is the expected behavior?**\r\n\r\nI expected not to have this error.\r\n\r\n**Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?**\r\n\r\nFrom what I know: this error occurs on any React renderer (got it on React Native in the first place), and started the project with React 15.5.\r\n\r\n**Related issues**\r\nMight be related to: #11081, #11086.\r\n\r\n-----\r\n\r\nPing: @gaearon "},"comment":{"url":"https://api.github.com/repos/facebook/react/issues/comments/334592275","html_url":"https://github.com/facebook/react/issues/11116#issuecomment-334592275","issue_url":"https://api.github.com/repos/facebook/react/issues/11116","id":334592275,"user":{"login":"gaearon","id":810438,"avatar_url":"https://avatars0.githubusercontent.com/u/810438?v=4","gravatar_id":"","url":"https://api.github.com/users/gaearon","html_url":"https://github.com/gaearon","followers_url":"https://api.github.com/users/gaearon/followers","following_url":"https://api.github.com/users/gaearon/following{/other_user}","gists_url":"https://api.github.com/users/gaearon/gists{/gist_id}","starred_url":"https://api.github.com/users/gaearon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gaearon/subscriptions","organizations_url":"https://api.github.com/users/gaearon/orgs","repos_url":"https://api.github.com/users/gaearon/repos","events_url":"https://api.github.com/users/gaearon/events{/privacy}","received_events_url":"https://api.github.com/users/gaearon/received_events","type":"User","site_admin":false},"created_at":"2017-10-05T21:06:52Z","updated_at":"2017-10-05T21:06:52Z","author_association":"MEMBER","body":"Here's an example of the second approach I was referring to: https://codesandbox.io/s/j7jlyp07l9\r\n\r\nIt's very close to what you did originally, but without the state duplication or the update-state-during-render issue.\r\n\r\nHope this helps!"}}
{"actor":{"display_login":"gaearon"}}