Create new Next.js page without the 'pages/' directory?

Viewed 138

Thinking of trying to develop a tool to make developing a Next.js/React Native application with one code base easier. Given an array of page objects, e.g.:

const pages = [
    {
        route: "index/",
        component: IndexPageComponent,
        prefetch: () => {},
        ...
    },
    ...
]

Any suggestions to generate Next.js pages on the fly from a list of components that can be shared with React Native's React Navigation library? Hoping to use a common list of components that automatically map to either platform using a React Native UI library supporting React Native Web.

Hoping something like this exists:

next.createApp(pages)

Such that the same pages can be passed to React Native easily as well. Anything like this exist already?

1 Answers

Nevermind, a legend named Fernando Rojo has already figured out a solution for this. Solito allows you to share code between Next.js and React Native. Looking forward to using this!

Related