{"action":"created","issue":{"url":"https://api.github.com/repos/ManuelDeLeon/viewmodel-react/issues/40","repository_url":"https://api.github.com/repos/ManuelDeLeon/viewmodel-react","labels_url":"https://api.github.com/repos/ManuelDeLeon/viewmodel-react/issues/40/labels{/name}","comments_url":"https://api.github.com/repos/ManuelDeLeon/viewmodel-react/issues/40/comments","events_url":"https://api.github.com/repos/ManuelDeLeon/viewmodel-react/issues/40/events","html_url":"https://github.com/ManuelDeLeon/viewmodel-react/issues/40","id":300787120,"number":40,"title":"Using ViewModel with Higher Order Components (HOC)","user":{"login":"davidsavoie1","id":25533167,"avatar_url":"https://avatars2.githubusercontent.com/u/25533167?v=4","gravatar_id":"","url":"https://api.github.com/users/davidsavoie1","html_url":"https://github.com/davidsavoie1","followers_url":"https://api.github.com/users/davidsavoie1/followers","following_url":"https://api.github.com/users/davidsavoie1/following{/other_user}","gists_url":"https://api.github.com/users/davidsavoie1/gists{/gist_id}","starred_url":"https://api.github.com/users/davidsavoie1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidsavoie1/subscriptions","organizations_url":"https://api.github.com/users/davidsavoie1/orgs","repos_url":"https://api.github.com/users/davidsavoie1/repos","events_url":"https://api.github.com/users/davidsavoie1/events{/privacy}","received_events_url":"https://api.github.com/users/davidsavoie1/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2018-02-27T20:48:21Z","updated_at":"2018-03-01T17:48:27Z","closed_at":null,"author_association":"NONE","body":"Good day!\r\nI'm trying to integrate routing in my application and I really liked the approach of [router5](http://router5.github.io/). When used with React, it is recommended (necessary?) to use [react-router5](https://github.com/router5/router5/tree/master/packages/react-router5). This package includes Higer Order Components (HOC) such as [`routeNode`](https://github.com/router5/router5/blob/master/packages/react-router5/modules/routeNode.js) which adds props `router`, `route` and `previousRoute` to the component passed as a parameter.\r\n\r\nI tried to use this with ViewModel like so:\r\n```js\r\nMain({\r\n  render() {},\r\n  ...\r\n});\r\nexport default routeNode('main')(Main);\r\n```\r\nI changed my import statement to use absolute import:\r\n```js\r\nimport Main from './Main/Main';\r\n```\r\nIt seems to be working at first. If I call `this.router()` or `this.route()` in my VM component, I do get an answer back, which I can use to control what to display... If I change url path manually, the page reloads (which is normal) and again, the view adjusts to the new url. However, if I change URL with the router method (ie `this.router().navigate('login')`), the page is not reloaded completely (_that's the point!_) and unfortunately the props don't update, so nothing changes.\r\n\r\nI know this could be a Router5 issue or something I'm doing wrong, but I'm asking here if it's **possible to use ViewModel components with HOC** as I've done here. Otherwise, I'll have to find another... route 😉!"},"comment":{"url":"https://api.github.com/repos/ManuelDeLeon/viewmodel-react/issues/comments/369673037","html_url":"https://github.com/ManuelDeLeon/viewmodel-react/issues/40#issuecomment-369673037","issue_url":"https://api.github.com/repos/ManuelDeLeon/viewmodel-react/issues/40","id":369673037,"user":{"login":"davidsavoie1","id":25533167,"avatar_url":"https://avatars2.githubusercontent.com/u/25533167?v=4","gravatar_id":"","url":"https://api.github.com/users/davidsavoie1","html_url":"https://github.com/davidsavoie1","followers_url":"https://api.github.com/users/davidsavoie1/followers","following_url":"https://api.github.com/users/davidsavoie1/following{/other_user}","gists_url":"https://api.github.com/users/davidsavoie1/gists{/gist_id}","starred_url":"https://api.github.com/users/davidsavoie1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidsavoie1/subscriptions","organizations_url":"https://api.github.com/users/davidsavoie1/orgs","repos_url":"https://api.github.com/users/davidsavoie1/repos","events_url":"https://api.github.com/users/davidsavoie1/events{/privacy}","received_events_url":"https://api.github.com/users/davidsavoie1/received_events","type":"User","site_admin":false},"created_at":"2018-03-01T17:48:27Z","updated_at":"2018-03-01T17:48:27Z","author_association":"NONE","body":"For the record, I went with [Universal-Router](https://www.kriasoft.com/universal-router/) combined with [History](https://github.com/ReactTraining/history). It works really well so far and the interaction with ViewModel seems great!\r\n\r\nI'd still be curious what went wrong with the others... And to get info on my imports question above!\r\n\r\nThanks a lot!"}}
{"actor":{"display_login":"davidsavoie1"}}