Need Explanation on getInitialProps Parameters
November 23, 2018 at 8:26amThe Next.js community has a new home. This thread is preserved for historical purposes. The content of this conversation may be innaccurrate or out of date. Go to new community home →
Need Explanation on getInitialProps Parameters
November 23, 2018 at 8:26amHello, Next.js community! 👋🏻
I've search the Spectrum threads and GitHub issues, and so far I can't seem to find any explanation or details on the parameters and return values for
getInitialProps
method. Is there an official API documentation or any kind of reference explaining this? Thanks in advance.November 23, 2018 at 8:52am
No good docs, nextjs is not well documented
Especially when you compose multiple
getInitialProps
, very handy to debug thingshttps://github.com/zeit/next.js/ go to the Fetching data and component lifecycle section
Yes, the readme already explains what parameters are availavle. But specifically, I need the IDE or editor to understand what exactly the parameters are and their types.
Also, in this part of the readme [1],
getInitialProps
has these parameters { Component, router, ctx }
, which Component
and router
parameter isn't documented on an earlier part of the readme[2].You can use
inspect(ctx)
from getInitialProps(ctx)
, it's easy to know what's going on.inspect()
? Where's that from?November 26, 2018 at 8:33am
Also this thread: https://spectrum.chat/?t=07e9ab0e-0fae-43a8-8bc0-350c79e921a3