{"action":"created","issue":{"url":"https://api.github.com/repos/bvaughn/react-virtualized/issues/431","repository_url":"https://api.github.com/repos/bvaughn/react-virtualized","labels_url":"https://api.github.com/repos/bvaughn/react-virtualized/issues/431/labels{/name}","comments_url":"https://api.github.com/repos/bvaughn/react-virtualized/issues/431/comments","events_url":"https://api.github.com/repos/bvaughn/react-virtualized/issues/431/events","html_url":"https://github.com/bvaughn/react-virtualized/issues/431","id":182336014,"number":431,"title":"declarative alternative to forceUpdateGrid","user":{"login":"jedwards1211","id":1448194,"avatar_url":"https://avatars.githubusercontent.com/u/1448194?v=3","gravatar_id":"","url":"https://api.github.com/users/jedwards1211","html_url":"https://github.com/jedwards1211","followers_url":"https://api.github.com/users/jedwards1211/followers","following_url":"https://api.github.com/users/jedwards1211/following{/other_user}","gists_url":"https://api.github.com/users/jedwards1211/gists{/gist_id}","starred_url":"https://api.github.com/users/jedwards1211/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jedwards1211/subscriptions","organizations_url":"https://api.github.com/users/jedwards1211/orgs","repos_url":"https://api.github.com/users/jedwards1211/repos","events_url":"https://api.github.com/users/jedwards1211/events{/privacy}","received_events_url":"https://api.github.com/users/jedwards1211/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-10-11T18:17:44Z","updated_at":"2016-10-11T21:28:08Z","closed_at":null,"body":"I always prefer to avoid using refs and calling component instance methods when possible.  Here is one way a declarative alternative to `forceUpdateGrid` would look:\r\n\r\n```es6\r\n<List\r\n  renderProps={{myData: [...]}}\r\n  rowRenderer={({index, key, style, myData}) => <MyRow key={key} data={myData[index]} />}\r\n/>\r\n```\r\nThis way whenever `renderProps` changes `List` will do the same thing as `forceUpdateGrid`.\r\n\r\nI implemented my own wrapper that provides that API as shown below.  But would you like this or a similar API to be a core part of `<List>` etc in `react-virtualized`?  I'd like to make a PR.\r\n```es6\r\nimport React, {Component} from 'react'\r\nimport {List as WrappedList} from 'react-virtualized'\r\n\r\nexport default class List extends Component {\r\n  componentDidUpdate(prevProps) {\r\n    if (this.list && prevProps.renderData !== this.props.renderData) this.list.forceUpdateGrid()\r\n  }\r\n  render() {\r\n    const {rowRenderer, renderData, ...props} = this.props\r\n    return (\r\n      <WrappedList\r\n        {...props}\r\n        ref={c => this.list = c}\r\n        rowRenderer={props => rowRenderer({...props, ...renderData})}\r\n      />\r\n    )\r\n  }\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/bvaughn/react-virtualized/issues/comments/253052092","html_url":"https://github.com/bvaughn/react-virtualized/issues/431#issuecomment-253052092","issue_url":"https://api.github.com/repos/bvaughn/react-virtualized/issues/431","id":253052092,"user":{"login":"bvaughn","id":29597,"avatar_url":"https://avatars.githubusercontent.com/u/29597?v=3","gravatar_id":"","url":"https://api.github.com/users/bvaughn","html_url":"https://github.com/bvaughn","followers_url":"https://api.github.com/users/bvaughn/followers","following_url":"https://api.github.com/users/bvaughn/following{/other_user}","gists_url":"https://api.github.com/users/bvaughn/gists{/gist_id}","starred_url":"https://api.github.com/users/bvaughn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bvaughn/subscriptions","organizations_url":"https://api.github.com/users/bvaughn/orgs","repos_url":"https://api.github.com/users/bvaughn/repos","events_url":"https://api.github.com/users/bvaughn/events{/privacy}","received_events_url":"https://api.github.com/users/bvaughn/received_events","type":"User","site_admin":false},"created_at":"2016-10-11T21:28:08Z","updated_at":"2016-10-11T21:28:08Z","body":"Hey @jedwards1211 😄\r\n\r\nThis topic is mentioned briefly [in the main `README`](https://github.com/bvaughn/react-virtualized/#pure-components) as an alternative to the public methods.\r\n\r\nBoth `List` and `Table` already pass-thru any additional `props` to `Grid` which should be sufficient to pass the `shallowCompare` check.\r\n\r\nAm I overlooking something? (I might be. Sorry if I am!)"}}
{"actor":{"display_login":"bvaughn"}}