In this video we're going to start to extract get initial props from indexed all James up to that custom
app component.
So let's get to it now when I say extract what I really mean right now is just copy paste.
I do want to have a get initial props in both locations so we can kind of test and make sure that we're
still able to fetch data from both the page we're trying to display and the custom app once we can ensure
that we can't fetch data in both locations at the same time we will then remove get initial prompts
from landing page.
So eventually this will go away.
But for right now we're going to have it in both locations again just to make sure we can fetch data
in both places.
OK.
So let's start off inside of this underscore abduct Jay file so he no longer wants you just directly
export this function.
Instead we need to somehow define that get initial prompts function on it so I can delete the expert
default and I'm going to assign this to a variable to I will call app component and you might be tempted
to call this app right here.
I encourage you not to do that.
Instead call it app component you're going to see why in just a moment so we can then define app component
not get initial props like so and I'll do an export default app component at the bottom down just as
we did back inside of our landing page inside to get initial props.
If we do any data fetching we need to make sure that we build up our axis client because we're going
to run into all these same issues around problems with our domain or the base url depending upon whether
we are running this code on the browser or on the server.
So we still have to require in or import in that build client file and use it to build up our access
client.
So at the very top we can add in an import for build client from up one directory API build line then
down inside of get initial props.
I would write out right here.
I would try to receive in some context argument.
That's what we would want to do.
But it turns out life is not quite so simple.
It's now that we've got this kind of scaffolding put together because I want to show you another diagram
just help you understand a little challenge with next J.S..