|
|
|
|
|
by idbehold
3523 days ago
|
|
One thing that is never explained in these universal/isomorphic react frameworks/boilerplates is how to make a fetch() against your own server (e.g. a relative route). There's this https://zeit.co/blog/next#data-fetching-is-up-to-the-develop... But what if my component looks like this: import React from 'react'
export class exports React.Component {
static async getInitialProps () {
const res = await fetch('/api/user/123')
const data = await res.json()
return { username: data.profile.username }
}
}
|
|
[0] http://react-server.io/