Giter Site home page Giter Site logo

Comments (9)

somus avatar somus commented on July 3, 2024 1

We are going to work on v2 of MERN starting today. I've put up a discussion thread for the roadmap of v2 at #146. I've put things which were discussed here in that thread. We can continue the discussion there.

from mern-starter.

mayankchd avatar mayankchd commented on July 3, 2024

Thanks a lot @timomeh for your feedback, we will look into it and make relevant changes!

from mern-starter.

timomeh avatar timomeh commented on July 3, 2024

Sweet! Some of my proposals are big changes which need to be discussed, so I don't want to simply open a pull request. But if I can help, I'd be glad to help!

from mern-starter.

sylvainlap avatar sylvainlap commented on July 3, 2024

About the 3rd point, it should be great to use a directory structure, with index.js files in it.

For example, in the redux directory, there should be a actions directory, a constants directory... with at the root of each one an index.js. So that a simple import { action1, action2 } from '../actions', or import * from '../constants' would work.

The same principle could be adapted for components. Each component could be in a directory (named after the component), with inside a index.jsx file.

from mern-starter.

timomeh avatar timomeh commented on July 3, 2024

Is a dedicated directory for actions and constants really necessary? A actions.js and constants.js in no dedicated directory fulfills the same goal, without having a directory with a single file in it.

from mern-starter.

sylvainlap avatar sylvainlap commented on July 3, 2024

Sure thing.

Maybe a directory could allow to have multiple files (for huge apps, where constants or actions should be splitted), and all these files could be exported into the index.js file.

But for a boilerplate, maybe only a file, and not a directory, is enough.

from mern-starter.

timomeh avatar timomeh commented on July 3, 2024

This could also be a good way to "force users to structure their app". No one likes refactoring. πŸ˜‰

For example, constants.js is just a list of constants. You won't have a few hundred lines of constants, so a single file is enough.
But all actions in a single file would get very messy as your app grows. Separating actions into multiple files (actions/PostAction.js, ...) and a re-exporting actions/index.js is nice for both small and growing apps.

This could also be helpful for reducers. Maybe together with redux's combineReducers (or its more verbose VanillaJS-equivalent).

from mern-starter.

prank7 avatar prank7 commented on July 3, 2024

@timomeh @sylvainlap We definitely need to put actions in multiple files and use combineReducers, also I think some people like to keep constants for different parts of their app like say admin or users in different constant files thus dedicated directories for them doesn't sound like an awful idea to me. πŸ˜‰

from mern-starter.

isomoar avatar isomoar commented on July 3, 2024

What about 1st and 2nd points? I think that after implementation of this improvements + different directory structure MERN source code would be absolutely identical to react-redux-universal-hot-example. The only different is MongoDB present.

from mern-starter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.