Replies: 2 comments
-
here's the code -- page1.js -- export async function getServerSideProps() {
return { props: {data: 'test'}}
}
export default ({data}) => (
<p>{data}</p>
) -- index.js -- import Page1 from './page1'
export default () => (
<Page1 someProp="Yes" />
) |
Beta Was this translation helpful? Give feedback.
0 replies
-
If you want to re-use a page and it's methods you should do this on your // index.js
export { default, getServerSideProps } from './page1' |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
suppose I have an
index.js
the looks like this:and given that
page1.js
is in thepages/
directory, it can take advantage of thegetServerSideProps
mechanism. how do I get access to the properties set by that function call when they get overridden by the call on the index page?or am I not supposed to compose one page with others but with components (in which case the responsibility of fetching data from some remote source cannot be delegated to the component)?
Appendix I
I guess by way of explanation, my index page creates a tab container and each of the tabs should display a page, ergo the need to create a page of pages
Beta Was this translation helpful? Give feedback.
All reactions