And if you don't like Next.js yourself, because I don't know, Peanuts, even remix in the repository for components, they are using camelCase. And that is not why they invented it. I mean, there's a reason behind this. So, I know that it could be hard. But for me, it's not negotiable.
Another thing is always using import alias to enhance maintainability of the code. Import aliases enable you to avoid using relative paths in your imports. So this kind of code that are super hard to read and understand where they come from, they come from this to this. It's much clearer by utilizing import aliases.
And finally, talking about the structure. This is the classic folder structure. I mean, it's fine. It's good for a lot of things. It's perfect for a small and medium projects. But when things get bigger, it's hard to scale. This is a different kind of folder structure that is super interesting for big and huge projects. And it's that your architecture should inform readers about the system itself, rather than the frameworks and dependencies that you are using. In the classic one, you have even a folder that is called Redux. So, in this case, if you are, I don't know, building a healthcare system, then new programmers view the source repository, and their initial impression should be, oh, this is a healthcare system. Some drawbacks, of course. The learning curve is complicated. The initial overload, the duplication risk, because maybe you duplicate some components. But at the end, for huge projects, it's a must.
In 20 minutes, it's complicated to talk about all the best practices on React. I tried to share some, based on my knowledge and my experience. But the most important thing is that you don't have to be afraid of changing your mind. For me, for example, it was like the case for file systems or components on the React applications. And sometimes it's only about checking, trying, and trying again. Before we go, one more thing. I would like to invite you to check Advent.js, an Advent calendar with challenges for JavaScript and TypeScript, developed with React, of course.
Comments