Skip to content

Using TS , Not children filed in props #35995

Answered by icyJoseph
gd-cho asked this question in Help
Discussion options

You must be logged in to vote

Why would a page need to have that prop type built in?

Are you trying to do something like this?

// pages/another-page.tsx
import MyPage from './pages/my-page'

const AnotherPage = ()=> <MyPage><div>Injecting content</div></MyPage>

export default AnotherPage;

While that's technically possible, it seems prone to grow in complexity.

A NextPage conceptually is a top level abstraction that represents an entire route/page, and it's not necessarily a React Component.

Why not remove the NextPage type, and move that to be a Layout Component, living for example in components/, and then use it as such, a Layout component, across pages.

The docs document a case that resembles my assumption, https:/…

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@gd-cho
Comment options

@icyJoseph
Comment options

@gd-cho
Comment options

@icyJoseph
Comment options

@azizoid
Comment options

Answer selected by gd-cho
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
3 participants