Next.js Discord

Discord Forum

Is Redux-like Feature-Based structure a bad practice?

Unanswered
European Golden-Plover posted this in #help-forum
Open in Discord
European Golden-PloverOP
For example, I use the following structure to eliminate global folders like lib and components from the project:

app/
|--blog/
   |--components/
      |--BlogPost.tsx
   |--lib/
      |--posts.ts
   |-page.tsx
|--home/
   |--page.tsx


Now I need to add a blog feed section to the homepage and I need to use the BlogPost component. Instead of having a global components folder, I import the component directly from app/blog/components:

import BlogPost from "@/app/blog/components/BlogPost"
import { getPosts } from "@/app/blog/lib/posts"

export default function Home() {
...
}


Is this bad practice in Next.js? I haven't seen Next.js projects with this structure as an example, it's usually found in Redux-based projects, but it seems to me convenient in any large project, regardless of whether Redux is used or not.

0 Replies