{"action":"created","issue":{"url":"https://api.github.com/repos/yoshuawuyts/sheet-router/issues/9","repository_url":"https://api.github.com/repos/yoshuawuyts/sheet-router","labels_url":"https://api.github.com/repos/yoshuawuyts/sheet-router/issues/9/labels{/name}","comments_url":"https://api.github.com/repos/yoshuawuyts/sheet-router/issues/9/comments","events_url":"https://api.github.com/repos/yoshuawuyts/sheet-router/issues/9/events","html_url":"https://github.com/yoshuawuyts/sheet-router/issues/9","id":143042587,"number":9,"title":"Using thunks returns null","user":{"login":"kvnneff","id":3835556,"avatar_url":"https://avatars.githubusercontent.com/u/3835556?v=3","gravatar_id":"","url":"https://api.github.com/users/kvnneff","html_url":"https://github.com/kvnneff","followers_url":"https://api.github.com/users/kvnneff/followers","following_url":"https://api.github.com/users/kvnneff/following{/other_user}","gists_url":"https://api.github.com/users/kvnneff/gists{/gist_id}","starred_url":"https://api.github.com/users/kvnneff/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kvnneff/subscriptions","organizations_url":"https://api.github.com/users/kvnneff/orgs","repos_url":"https://api.github.com/users/kvnneff/repos","events_url":"https://api.github.com/users/kvnneff/events{/privacy}","received_events_url":"https://api.github.com/users/kvnneff/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-03-23T18:26:32Z","updated_at":"2016-03-25T07:27:22Z","closed_at":"2016-03-25T07:27:22Z","body":"Whenever I attempt to use `thunk` over `route` with sheet-router `null` gets returned rather than a vnode.  I didn't see any tests using the thunk option, is this confirmed to be working or am I not using it correctly?\r\n\r\nI made a requirebin to demonstrate: http://requirebin.com/?gist=058decac3c6efe06454a"},"comment":{"url":"https://api.github.com/repos/yoshuawuyts/sheet-router/issues/comments/201180451","html_url":"https://github.com/yoshuawuyts/sheet-router/issues/9#issuecomment-201180451","issue_url":"https://api.github.com/repos/yoshuawuyts/sheet-router/issues/9","id":201180451,"user":{"login":"yoshuawuyts","id":2467194,"avatar_url":"https://avatars.githubusercontent.com/u/2467194?v=3","gravatar_id":"","url":"https://api.github.com/users/yoshuawuyts","html_url":"https://github.com/yoshuawuyts","followers_url":"https://api.github.com/users/yoshuawuyts/followers","following_url":"https://api.github.com/users/yoshuawuyts/following{/other_user}","gists_url":"https://api.github.com/users/yoshuawuyts/gists{/gist_id}","starred_url":"https://api.github.com/users/yoshuawuyts/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yoshuawuyts/subscriptions","organizations_url":"https://api.github.com/users/yoshuawuyts/orgs","repos_url":"https://api.github.com/users/yoshuawuyts/repos","events_url":"https://api.github.com/users/yoshuawuyts/events{/privacy}","received_events_url":"https://api.github.com/users/yoshuawuyts/received_events","type":"User","site_admin":false},"created_at":"2016-03-25T07:27:22Z","updated_at":"2016-03-25T07:27:22Z","body":"So what `thunk` does is decouple the `path` matching from the dom node being returned. It's got a signature of:\r\n```txt\r\n(string) -> (obj, ...any) -> any\r\n```\r\nthe regular router path has a signature of:\r\n```txt\r\n(string, obj, ...any) -> any\r\n````\r\n\r\nThe reason of doing this is because state changes can happen up to 60 times a second, whereas path changes are a lot less common. By using a thunk this can be optimized by doing a very cheap `previousPath === newPath` check to determine if the routing tree should be traversed or not. [`bridge.js`](https://github.com/yoshuawuyts/sheet-router/blob/master/bridge.js) has an implementation that provides this check.\r\n\r\nSo to fix your example, change line 13 to:\r\n```js\r\nconst node = render(router('/foo/bar')(h, { name: 'Jane' }))\r\n```\r\n\r\nI agree the documentation is a bit shoddy, and `s`, `t` as arguments can be a bit confusing - if you've got a good idea on how to make this a smoother experience I'd be keen to hear!\r\n\r\nI hope this answers your question! Cheers :sparkles:"}}