![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
unflatten-next-routes
Advanced tools
A CLI tool to simplify Next.js routing by allowing developers to work with a flat route structure
Enabling flat routes for Next.js
With the introduction of Next.js 13, a new folder-based routing mechanism was unveiled. While this approach offers powerful and flexible routing capabilities, it brings with it the challenge of managing deeply nested route files. In large projects with a myriad of routes, locating a specific route or deciphering the intricate structure of the application becomes increasingly complex.
Enter unflatten-next-routes
.
Designed specifically for Next.js 13, unflatten-next-routes
is a CLI tool that allows developers to work with a flat route file structure that is easier to manage and understand. With unflatten-next-routes
your routes can be structured like this:
app/
|-- shop/
|-- routes/
|-- basket.(page).tsx
|-- product.(page).tsx
|-- product.[id].(page).tsx
... and unflatten-next-routes
will ensure that these routes are transformed into the nested format that Next.js expects.
To start using the CLI tool, run the following command in the Next.js project root:
npx unflatten-next-routes@latest
This will initiate the tool in watch mode. Then add flat route files within any /routes/
folder located within the app
directory. As you add, rename, or remove these flat route files, the equivalent nested route file will be generated or updated within a parallel /(.routes)/
directory.
Example:
app/
|-- shop/
|-- (.routes)/
| |-- basket/
| | |-- page.tsx
| |-- product/
| |-- page.tsx
| |-- [id]/
| |-- page.tsx
|-- routes/
|-- basket.(page).tsx
|-- product.(page).tsx
|-- product.[id].(page).tsx
Note: The
/(.routes)/
directory should be considered as "private", similar to the.next
directory that Next.js uses for its build output. Files within this directory are auto-generated and should not be manually edited.
Flat routes can be created for page.tsx
, layout.tsx
, loading.tsx
, error.tsx
and route.tsx
files. All that is required is for their flat route equivalent filenames to end with .(page).tsx
, .(layout).tsx
, .(loading).tsx
, .(error).tsx
and .(route).tsx
.
Example:
/app/shop/routes/basket.(page).tsx
/app/shop/routes/product.(layout).tsx
/app/shop/routes/product.[productId].(page).tsx
/app/admin/routes/settings.(page).tsx
For flat index route files, there's no need to prefix the route filename. For instance, the admin homepage will be:
/app/admin/(page).tsx
/app/admin/(error).tsx
The tool supports .tsx, .jsx, and .js file extensions for flat route files.
v0.1.3
.ts
extension (00dc28c)FAQs
A CLI tool to simplify Next.js routing by allowing developers to work with a flat route structure
The npm package unflatten-next-routes receives a total of 0 weekly downloads. As such, unflatten-next-routes popularity was classified as not popular.
We found that unflatten-next-routes demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.