{"action":"created","issue":{"url":"https://api.github.com/repos/zeit/next.js/issues/4154","repository_url":"https://api.github.com/repos/zeit/next.js","labels_url":"https://api.github.com/repos/zeit/next.js/issues/4154/labels{/name}","comments_url":"https://api.github.com/repos/zeit/next.js/issues/4154/comments","events_url":"https://api.github.com/repos/zeit/next.js/issues/4154/events","html_url":"https://github.com/zeit/next.js/issues/4154","id":314267499,"number":4154,"title":"Handling componentWillReceiveProps deprecation in React >= 17","user":{"login":"gcpantazis","id":1161192,"avatar_url":"https://avatars1.githubusercontent.com/u/1161192?v=4","gravatar_id":"","url":"https://api.github.com/users/gcpantazis","html_url":"https://github.com/gcpantazis","followers_url":"https://api.github.com/users/gcpantazis/followers","following_url":"https://api.github.com/users/gcpantazis/following{/other_user}","gists_url":"https://api.github.com/users/gcpantazis/gists{/gist_id}","starred_url":"https://api.github.com/users/gcpantazis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gcpantazis/subscriptions","organizations_url":"https://api.github.com/users/gcpantazis/orgs","repos_url":"https://api.github.com/users/gcpantazis/repos","events_url":"https://api.github.com/users/gcpantazis/events{/privacy}","received_events_url":"https://api.github.com/users/gcpantazis/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-04-13T22:25:48Z","updated_at":"2018-04-14T06:04:34Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"The docs currently reference `componentWillReceiveProps` as the recommended way to listen to route changes when using shallow routing:\r\n\r\n```\r\nYou can watch for URL changes via componentWillReceiveProps hook as shown below:\r\n\r\ncomponentWillReceiveProps(nextProps) {\r\n  const { pathname, query } = nextProps.url\r\n  // fetch data based on the new query\r\n}\r\n```\r\n\r\nThis lifecycle, however, is on the deprecation path; it will stop working as-named in React 17: https://reactjs.org/docs/react-component.html#unsafe_componentwillreceiveprops\r\n\r\nGiven that, we should provide a more future-friendly solution for listening for shallow route changes. Perhaps adding a `popstate` listener in `componentDidMount`. If that seems like the best option I can add it to docs, but opening this ticket for discussion/tracking."},"comment":{"url":"https://api.github.com/repos/zeit/next.js/issues/comments/381306452","html_url":"https://github.com/zeit/next.js/issues/4154#issuecomment-381306452","issue_url":"https://api.github.com/repos/zeit/next.js/issues/4154","id":381306452,"user":{"login":"timneutkens","id":6324199,"avatar_url":"https://avatars2.githubusercontent.com/u/6324199?v=4","gravatar_id":"","url":"https://api.github.com/users/timneutkens","html_url":"https://github.com/timneutkens","followers_url":"https://api.github.com/users/timneutkens/followers","following_url":"https://api.github.com/users/timneutkens/following{/other_user}","gists_url":"https://api.github.com/users/timneutkens/gists{/gist_id}","starred_url":"https://api.github.com/users/timneutkens/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timneutkens/subscriptions","organizations_url":"https://api.github.com/users/timneutkens/orgs","repos_url":"https://api.github.com/users/timneutkens/repos","events_url":"https://api.github.com/users/timneutkens/events{/privacy}","received_events_url":"https://api.github.com/users/timneutkens/received_events","type":"User","site_admin":false},"created_at":"2018-04-14T06:04:34Z","updated_at":"2018-04-14T06:04:34Z","author_association":"OWNER","body":"I guess we should just use https://reactjs.org/docs/react-component.html#static-getderivedstatefromprops 🤔 "}}
{"actor":{"display_login":"timneutkens"}}