{"action":"created","issue":{"url":"https://api.github.com/repos/zeit/next.js/issues/418","repository_url":"https://api.github.com/repos/zeit/next.js","labels_url":"https://api.github.com/repos/zeit/next.js/issues/418/labels{/name}","comments_url":"https://api.github.com/repos/zeit/next.js/issues/418/comments","events_url":"https://api.github.com/repos/zeit/next.js/issues/418/events","html_url":"https://github.com/zeit/next.js/issues/418","id":196228424,"number":418,"title":"Routing questions - params patterns like:   \"/profile/:id/edit\"  and server db -how to pass data to react components?","user":{"login":"Ajar-Ajar","id":2492303,"avatar_url":"https://avatars.githubusercontent.com/u/2492303?v=3","gravatar_id":"","url":"https://api.github.com/users/Ajar-Ajar","html_url":"https://github.com/Ajar-Ajar","followers_url":"https://api.github.com/users/Ajar-Ajar/followers","following_url":"https://api.github.com/users/Ajar-Ajar/following{/other_user}","gists_url":"https://api.github.com/users/Ajar-Ajar/gists{/gist_id}","starred_url":"https://api.github.com/users/Ajar-Ajar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ajar-Ajar/subscriptions","organizations_url":"https://api.github.com/users/Ajar-Ajar/orgs","repos_url":"https://api.github.com/users/Ajar-Ajar/repos","events_url":"https://api.github.com/users/Ajar-Ajar/events{/privacy}","received_events_url":"https://api.github.com/users/Ajar-Ajar/received_events","type":"User","site_admin":false},"labels":[{"id":455907200,"url":"https://api.github.com/repos/zeit/next.js/labels/Type:%20Question","name":"Type: Question","color":"cc317c","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-12-17T15:54:56Z","updated_at":"2016-12-17T18:34:40Z","closed_at":null,"body":"hi, I know this issue was discussed before but I wasn't able to find a clear answer to this pattern.\r\nFirst - correct me if I'm wrong, if you don't implement a custom server (http or express) the Link component supports only query string parameters like \"/profile?id=123&action=edit\"  am I correct?\r\nTo be able to work with a url params pattern like \"/profile/:id\" you need to implement a custom server... this was the best I was able to guess going through the examples...\r\nIf so - how would you implement a pattern like \"/profile/:id/edit\" \r\nIn the 'parameterized-routing' example the index.js is using links like this one:\r\n`<Link href='/blog?ip=first' as='/blog/first'><a>My first blog post</a></Link>`\r\n\r\nand I wasn't able to decipher what is the necessary workflow on server.js\r\nserver.js declares `const match = route('/blog/:id')`\r\n\r\nand then it is unclear what exactly goes to the address bar, and what is the data that is being pushed to the react component? \r\nHow do I handle routes like \"/profile/:id/edit\"\r\nHow do I handle many routes in a generic way (coming from react-router I was looking for the match utility equivalent...)\r\nAlso, if I have db data fetching before rendering - how can I pass the fetched data to the react component.\r\nAll of these are a bit obscure and I would seriously appreciate your help as I was trying to guess my way through with no success.\r\n\r\nThank you\r\nAjar \r\n\r\n"},"comment":{"url":"https://api.github.com/repos/zeit/next.js/issues/comments/267778974","html_url":"https://github.com/zeit/next.js/issues/418#issuecomment-267778974","issue_url":"https://api.github.com/repos/zeit/next.js/issues/418","id":267778974,"user":{"login":"arunoda","id":50838,"avatar_url":"https://avatars.githubusercontent.com/u/50838?v=3","gravatar_id":"","url":"https://api.github.com/users/arunoda","html_url":"https://github.com/arunoda","followers_url":"https://api.github.com/users/arunoda/followers","following_url":"https://api.github.com/users/arunoda/following{/other_user}","gists_url":"https://api.github.com/users/arunoda/gists{/gist_id}","starred_url":"https://api.github.com/users/arunoda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arunoda/subscriptions","organizations_url":"https://api.github.com/users/arunoda/orgs","repos_url":"https://api.github.com/users/arunoda/repos","events_url":"https://api.github.com/users/arunoda/events{/privacy}","received_events_url":"https://api.github.com/users/arunoda/received_events","type":"User","site_admin":false},"created_at":"2016-12-17T18:34:40Z","updated_at":"2016-12-17T18:34:40Z","body":"This is a set of good questions.\r\nWe'll add more info on the docs.\r\n\r\nFor now, think like this:\r\n\r\n* Next.js only knows how to serve pages and data should be pass via params. (Like: `/blog?id=first`)\r\n* With #310 we allow a way to customize how it looks to the outside world. (Like: `blog/:id` [See](https://github.com/zeit/next.js/blob/master/examples/custom-server-express/server.js#L11)\r\n* And when you are doing client side routing, client side app don't know anything about custom urls.\r\n* So, you need use Link as: `<Link href='/blog?id=first' as='/blog/first' />`\r\n  * href: this is the actual url of the page\r\n  * as: this is how it should looks like in the browser (typically, it should match with your custom URL pattern)\r\n\r\n"}}
{"actor":{"display_login":"arunoda"}}